Practice30Create account

A word-and-number arrangement machine works on an input line of words and two-digit numbers in steps. In each step it finds the leftmost number whose tens digit is greater than its units digit and writes that number backwards in the place where it stands. Nothing changes position — only the digits of that one number are turned round — and the machine stops as soon as every number in the line has its tens digit smaller than its units digit.
Input: 74 marsh 26 nectar 53 olive 18.
In the last step of the above arrangement, which element is fifth from the left end?

Competition practiceInput-Output
  • A35
  • B53
  • Cnectar
  • Dolive

Step-by-Step Solution

The offenders are 74 and 53; 26 and 18 already run upward. Step 1: 47 marsh 26 nectar 53 olive 18. Step 2, the last: 47 marsh 26 nectar 35 olive 18. Counting from the left: 47, marsh, 26, nectar, 35 — so 35 is fifth. Reading the input rather than the last step leaves 53 in that place, since nothing ever changes position under this machine. Stopping a place short gives nectar and running a place past gives olive.
Answer: A) 35

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 works on an input line of words and two-digit…A word-and-number arrangement machine works on an input line of words and two-digit…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,…