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 word having the most letters, among the words not already shifted in an earlier step, is taken out and placed at the extreme right end of the line; if two words are equally long, the one that comes earlier in alphabetical order is taken first. Every other element keeps its relative position, and the machine stops once every word has been shifted.
Input: umbrella 39 pod 64 crystal 17 vane 85.
At which step of the above arrangement does the line "39 pod 64 17 vane 85 umbrella crystal" appear?

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

Step-by-Step Solution

Letter counts: umbrella 8, crystal 7, vane 4, pod 3. Step 1: 39 pod 64 crystal 17 vane 85 umbrella. Step 2: 39 pod 64 17 vane 85 umbrella crystal — the line asked about. Step 3 would be 39 pod 64 17 85 umbrella crystal vane and Step 4 would be 39 64 17 85 umbrella crystal vane pod. The giveaway is that vane and pod are still sitting in mid-line, so only two words have been shifted so far.
Answer: D) 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,…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,…A word-and-number arrangement machine, when given an input line of words and numbers,…