Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the machine looks at the words that contain a double letter — the same letter twice in a row — and takes the one standing furthest to the left among those not already shifted, placing it at the extreme left end of the line. Words with no double letter, and all the numbers, are never shifted; every other element keeps its relative position, and the machine stops once every double-letter word has been shifted.
Input: 39 kettle marsh 82 ribbon 15 quartz 64.
In Step 2 of the above arrangement, which element is fourth from the left end?

Competition practiceInput-Output
  • Amarsh
  • B39
  • C82
  • Dkettle

Step-by-Step Solution

Kettle has tt and ribbon has bb; marsh and quartz have no double letter and never move. Kettle stands further left, so it goes first. Step 1: kettle 39 marsh 82 ribbon 15 quartz 64. Step 2: ribbon kettle 39 marsh 82 15 quartz 64. Counting from the left: ribbon, kettle, 39, marsh — so marsh is fourth. Stopping a place short gives 39, running a place past gives 82, and reading Step 1 instead of Step 2 puts kettle in view.
Answer: A) marsh

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…An arrangement machine reshuffles an input line by reversing a block of elements at the…An arrangement machine reshuffles an input line by reversing a block of elements at the…