An Initiative by SAARTHI IAS
Maarg Manthan · Topic 17.2

Word-Based Input-Output Rearrangement (Alphabetical Order)

Reasoning › Input-Output · Topic 17.2

In word-based input-output problems, a machine rearranges a line of words step by step using alphabetical order. In each step one word, such as the one coming first or last in dictionary order, is moved to a fixed end, and the other words keep their order. Compare words letter by letter from the first letter, and use the second and third letters only when earlier letters match.

Share:
Word-Based Input-Output Rearrangement (Alphabetical Order) - Reasoning - MaargX UPSC Maarg Manthan

Quick Answer

In word-based input-output problems, a machine rearranges a line of words step by step using alphabetical order. In each step one word, such as the one coming first or last in dictionary order, is moved to a fixed end, and the other words keep their order. Compare words letter by letter from the first letter, and use the second and third letters only when earlier letters match.

At a Glance

  • Input A line of words
  • Order Alphabetical (dictionary) order
  • Compare First letter, then second, then third
  • Left build Alphabetically first goes to the left
  • Right build Alphabetically last (or first) goes to the right
  • Others Keep their order

Where Does It Fit?

This topic applies the step logic of Number-Based Input-Output Rearrangement (Ascending/Descending Order) to words. It is followed by mixed lines in Mixed Word-Number Input-Output Problems, and the step-finding questions of Identifying the Step Number at Which a Given Arrangement Is Achieved are built on the same lines.

How Do You Compare Words Alphabetically?

In short: compare the first letters; if they match, compare the second letters; continue until letters differ, and a shorter word that matches the start of a longer one comes first.

Words Deciding letter Alphabetical order
bell, cup First letters b and c bell, cup
cab, cat, cap Third letters b, t, p cab, cap, cat
pea, peach, pear Shorter word first, then fifth letters c and r pea, peach, pear
tiger, tulip Second letters i and u tiger, tulip

Write the alphabetical order of all words at the start of the question. The final line of a machine is usually this order or its reverse, so the full sort tells you where every word ends up.

  • Same first letter: go to the second letter.
  • One word inside another: the shorter word comes first.
  • Dictionary order: alphabetical order is the same as dictionary order.

What Rules Do Word Machines Use?

In short: each step moves one word chosen by alphabetical position to the next free place at an end, and the other words keep their order.

Rule Each step Final order
First to the left Alphabetically first remaining word goes to the next free place from the left A to Z
Last to the right Alphabetically last remaining word goes to the next free place from the right A to Z
Last to the left Alphabetically last remaining word goes to the next free place from the left Z to A
First to the right Alphabetically first remaining word goes to the next free place from the right Z to A

Step logic

  • One word moves per step.
  • The placed block grows from one end.
  • At most n – 1 steps for n words.

The same reading of steps is used for numbers in Number-Based Input-Output Rearrangement (Ascending/Descending Order).

How Do You Answer Questions on a Later Step?

In short: sort the words, then build the requested step by placing the first k sorted words in the fixed block and leaving the rest in their original order.

  1. Sort the words alphabetically.
  2. Decide the rule from Step I.
  3. For Step k, place the first k sorted words (for a left build) in order at the left.
  4. Copy the rest in their original order.
  5. Read the required word or position.

Solved Examples

Example 1

Question: Input: pen cup rose bell fan mat. In each step, the alphabetically first of the words not yet placed is moved to the next free place from the left. What is the final line, and at which step is it reached?

  1. The alphabetical order is bell, cup, fan, mat, pen, rose.
  2. Step I: bell goes first, giving bell pen cup rose fan mat.
  3. Step II: cup goes second, giving bell cup pen rose fan mat.
  4. Step III: fan goes third, giving bell cup fan pen rose mat.
  5. Step IV: mat goes fourth, giving bell cup fan mat pen rose. The last two words are now in order.

Answer: The final line is bell cup fan mat pen rose, reached at Step IV.

Example 2

Question: Input: tiger mango apple lemon zebra goat. In each step, the alphabetically last of the words not yet placed is moved to the next free place from the right. What is Step III?

  1. Step I: zebra goes to the right end, giving tiger mango apple lemon goat zebra.
  2. Step II: tiger goes second from the right, giving mango apple lemon goat tiger zebra.
  3. Step III: mango goes third from the right, giving apple lemon goat mango tiger zebra.

Answer: Step III is apple lemon goat mango tiger zebra.

Example 3

Question: Input: dog ant cow bat eel. In each step, the alphabetically first of the words not yet placed is moved to the next free place from the left. Show all steps.

  1. Step I: ant goes first, giving ant dog cow bat eel.
  2. Step II: bat goes second, giving ant bat dog cow eel.
  3. Step III: cow goes third, giving ant bat cow dog eel. The line is now alphabetical.

Answer: Three steps are needed, and the final line is ant bat cow dog eel.

Example 4

Question: Input: mango fig plum date kiwi lime. In each step, the alphabetically first of the words not yet placed is moved to the next free place from the right. At which step is the line plum mango lime kiwi fig date obtained?

  1. Step I: date goes to the right end, giving mango fig plum kiwi lime date.
  2. Step II: fig goes second from the right, giving mango plum kiwi lime fig date.
  3. Step III: kiwi goes third from the right, giving mango plum lime kiwi fig date.
  4. Step IV: lime is already in the fourth place from the right, so the line is unchanged.
  5. Step V: mango goes fifth from the right, giving plum mango lime kiwi fig date.

Answer: The line is obtained at Step V.

Example 5

Question: In the first example, which word is third from the right in Step II?

  1. Step II is bell cup pen rose fan mat.
  2. From the right the words are mat, fan, rose.

Answer: rose.

Shortcuts and Tricks

  • Write the sorted order of all words before starting.
  • Compare letter by letter, and put a shorter word first when it is the start of a longer one.
  • Use the sorted list to read off Step k directly.
  • Copy unchanged words in their old order.
  • A step can leave the line unchanged if the chosen word is already in place.

Common Mistakes

  • Comparing the last letters instead of the first.
  • Putting a longer word before its shorter prefix.
  • Reordering all words in a step.
  • Mixing up the left and right ends.
  • Skipping a step that leaves the line unchanged.

Practice Questions

  1. Input: hen ant owl cat. Each step moves the alphabetically first remaining word to the next free place from the left. What is Step II?
  2. Input: fox bee yak cow. Each step moves the alphabetically last remaining word to the next free place from the right. What is Step II?
  3. Which word comes first alphabetically: pear, peach, plum or pea?
  4. Which comes first alphabetically: cat or cab?
  5. Input: sun ant mat. Each step moves the alphabetically first remaining word to the next free place from the left. How many steps are needed?

Answers: 1) ant cat hen owl; 2) bee cow fox yak; 3) pea; 4) cab; 5) 2.

Why Is This Topic Important?

  • Exam frequency Word machines are common in bank prelims.
  • Skill They test careful dictionary comparison under time pressure.
  • Reuse The step logic is the same as for numbers.
  • Link Questions on step numbers follow in Identifying the Step Number at Which a Given Arrangement Is Achieved.

What Comes Next?

The next topic is Mixed Word-Number Input-Output Problems. It combines words and numbers in one line, each sorted by its own rule.

Key Terms and Formulas

  • Alphabetical order Dictionary order of words
  • Prefix The start of a longer word
  • Left build Words placed from the left end
  • Right build Words placed from the right end
  • Placed block Words already fixed
  • Step One application of the rule

Exam Corner

Points to Remember

  • Compare first letters, then second, then third.
  • A shorter prefix word comes first.
  • One word moves per step.
  • Sort the words first.
  • The input is not a step.

Do Not Confuse With

  • First vs last alphabetically First is nearest A; last is nearest Z.
  • Left build vs right build They fix opposite ends first.
  • Alphabetical vs length order Rules can use length, but alphabetical uses letters.
  • Shorter word vs smaller word The shorter word comes first only when it is a prefix.

Memory Hook

Sort the words, pick by A-to-Z, move one per step.

GS Relevance

Word-arrangement machines are a regular input-output form in IBPS PO, SBI PO and SSC prelims, where the machine sorts words alphabetically over several steps.

Frequently Asked Questions

How do you solve word-based input-output questions?

Sort the words alphabetically first. Compare the input with Step I to see which word moved and to which end, then apply the same rule step by step, moving one word per step and keeping the others in their old order. For a later step, place the first k sorted words in the fixed block.

How do you compare words in alphabetical order?

Compare the first letters; if they match, compare the second letters, and so on until the letters differ. If one word is the start of another, the shorter word comes first, so pea comes before peach, and peach comes before pear because c comes before r.

What does the first to the left rule do?

It moves the alphabetically first of the remaining words to the next free place from the left in each step. After k steps, the first k places hold the k alphabetically earliest words in order, and the rest keep their original order, so the line ends in A to Z order.

How many steps does a word machine need?

At most one fewer than the number of words, because the last word falls into place when the others are fixed. It can finish earlier when the last words of the line are already in order, as in an input where the final two words are in alphabetical order.

Does the step count include the input line?

No. The input is the starting line, and Step I is the first line produced by the rule. A question that asks for Step III means the line after three applications of the rule, so the input is never counted as a step.

PYQ Practice — Statement Analysis

1 The word pea comes before peach in alphabetical order.
True

A shorter word that begins a longer one comes first.

2 In each step of a word machine all words are rearranged alphabetically.
False

Only one word moves per step.

3 Comparing the last letters decides alphabetical order.
False

Comparison starts at the first letter.

4 With 6 words and a one-word-per-step rule, at most 5 steps are needed.
True

The last word is placed automatically.

Share: