Practice30Create account

A word-rearranging machine, given an input line of words, produces one step per pass. Example — Input: 'tree apple sun moon car'. Step I: 'apple tree sun moon car'. Step II: 'apple car tree sun moon'. Step III: 'apple car moon tree sun'. Step IV: 'apple car moon sun tree' (final). In each step the next word in alphabetical order is moved into its correct left-most remaining position, while the other words keep their relative order. For the input 'delta bravo echo alpha charlie', which line is Step II?

Competition practiceInput-Output
  • Aalpha bravo delta echo charlie
  • Balpha bravo delta charlie echo
  • Calpha delta bravo echo charlie
  • Dalpha bravo charlie delta echo

Step-by-Step Solution

Alphabetical target: alpha, bravo, charlie, delta, echo. Step I moves 'alpha' to the front: 'alpha delta bravo echo charlie'. Step II moves 'bravo' into second place, the rest keeping order: 'alpha bravo delta echo charlie'.
Answer: A) alpha bravo delta echo charlie

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 machine rearranges an input line in steps. Worked example — Input: gap…A word-and-number machine rearranges an input line in steps. Worked example — Input: gap…A word-and-number machine rearranges an input line in steps. Worked example — Input: gap…A word-and-number arrangement machine rearranges an input line one element per step.…A word-and-number arrangement machine rearranges an input line one element per step.…