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: 34 valley 71 cedar 58 ripple 92 cotton 26 thorn.
At which step of the above arrangement does the line "ripple valley 34 71 cedar 58 92 cotton 26 thorn" appear?

Competition practiceInput-Output
  • AStep 1
  • BStep 2
  • CStep 3
  • DStep 4

Step-by-Step Solution

Valley (ll), ripple (pp) and cotton (tt) all qualify; cedar and thorn do not. Taking the leftmost qualifying word each time gives the order valley, ripple, cotton. Step 1: valley 34 71 cedar 58 ripple 92 cotton 26 thorn. Step 2: ripple valley 34 71 cedar 58 92 cotton 26 thorn — the line asked about. Step 3, the last, would be cotton ripple valley 34 71 cedar 58 92 26 thorn. The tell is that cotton is still standing in mid-line, so only two of the three qualifying words have been shifted. There is no Step 4, because only three words carry a double letter.
Answer: B) Step 2

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,…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…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…