__WHAT IS INPUT OUTPUT__

Machine input or Input Output is a question type, where the candidate is given some kind of word and number arrangement. With each subsequent operation, the arrangement of the words and numbers changes. These operations are performed until a final arrangement is reached or is performed in loop. The student is required to identify the hidden pattern in the rearrangement and apply it to the questions.

__Example:__

- A word arrangement machine when given an input of words, rearranges them following a particular rule in each step. The following is an illustration of input and steps rearrangement.

This is the final arrangement and STEP IV is the last step for this input.

What should be the last step of the following input?

**INPUT: Coal Steer Brief Nap Blast Cry**

**Explanation: **The given rearrangement has a pattern that can be followed from the input step to the final step, which is Step IV. Observe carefully. The rearrangement follows the following patterns:

- The rearrangement is taking place from left to right.
- The rearrangement is taking place one word at a time.
- The rearrangement is done on the basis of decreasing alphabetic order.

**NOTE: **To understand the pattern, often it is sufficient to look at the input, 1^{st}, 2^{nd} and final steps of the arrangement.

Now if we apply the same pattern rules to the second input given, we can immediately tell what the output (final step after rearrangement) would be:

INPUT: Coal Steer Brief Nap Blast Cry

OUTPUT: Steer Nap Cry Coal Brief Blast

__TYPES OF QUESTIONS__

This was a simple example involving only words. Some questions come with only numbers. Others come as a mix of words and numbers. More complicated ones may even involve symbols. But for the sake of the Bank PO exams, it is important to concentrate on the questions that are mixes of words and numbers.

Based on the logic used behind the rearrangement, we can classify these types of questions as:

**A. Rearrangements based on Ordering:**

Words are arranged alphabetically (forward or reversed) as per their positions in the dictionary while numbers are arranged in ascending/descending order.

Both words and numbers could be arranged individually or simultaneously in each step. The rearrangement can start from the leftmost side or the rightmost side of the sentence and sometimes even simultaneously from both the ends. The rearrangement could either start with a word or a number. Whatever the finer details may be, in these kinds of rearrangements, one or two words/numbers are shifted at a time, without changing the order of the remaining words/numbers.

Here, Step III is the final step and the rearrangement is done simultaneously from both front and back ends. The rearrangements are done thusly: the numbers are arranged in ascending order one by one from the left end, with the next biggest number being added to the right of the previous number. The words are arranged in descending order one by one from the right end, with the last word in the dictionary going to the rightmost end, and earlier entries in the dictionary getting added in subsequent steps to the left of that word.

**B. Rearrangements based on Interchanging the Positions of Words and Numbers:**

Specific positions are selected and the positions of only those words/numbers are exchanged. The positions of all others remain unchanged.

Step VII is the final step of the input. The underlined words are used to indicate the words that will be interchanged in the each subsequent step.

**C. Rearrangements based on Mathematical operations:**

Some mathematical operation (like squaring the number, adding the digits within the number, some common number added/subtracted/multiplied/divided to each number etc.) is applied on the numbers in each step.

Step III is the final step. Clearly in this example, the unit’s digits of the left most and right most number are simultaneously being subtracted from the numbers themselves. This is followed by the number to the right of the left most one, and to the left of the right most one.

__TIPS ABOUT NUMBER OF STEPS__

- If there are ‘n’ words/digits in the input then at most ‘n-1’ steps are required to rearrange it completely.
- Number of words/digits arranged until the present step is greater than or equal to the present step number.
- If input is not given we cannot determine the previous step from given step number or we cannot determine input from given step number.

__HOW TO SOLVE__

These questions can be solved by the following methods:

1. We can solve these questions by writing each step of the given input on paper.

**Remember** – do not write the complete word each time; to save time, just write the first letter or however many letters of each word you need to uniquely identify it.

__Example:__

**Input:** 32 pure girl beautiful 49 63 78 random rickshaw

**Label:** 32 P G B 49 63 78 Ra Ri

2. We could go for a shorter method where instead of writing each step again and again we number each word/number of the input as per their position in each step. So if the arrangement follows a “number-descending-from-left-and-letters-ascending-from-right-alternately-pattern”, we need to number these as follows:

Clearly the pattern is, ‘send the biggest number left’. In the next step, send the highest word right. Continue the pattern till the input is completely rearranged.

To minimize the steps, let us look at all the elements on the basis of their positions. We only need to see the first two steps and the output to figure out which number/word goes where. The order in which the element gets rearranged is the number each element gets.

**INPUT:** 32 pure girl beautiful 49 63 78 rickshaw random

**LABEL: ** 7 6 8 9 5 3 1 2 4

Since ‘78’ is the first element that will be rearranged according to the pattern, it will be labeled 1. The next element to be rearranged will be ‘rickshaw’. So it will be labeled 2. The next element to be rearranged will be the next highest number. So without even writing out the remaining steps you could label ‘63’ as 3. And similarly ‘random’ would become 4. And so on and so forth.

While rearranging by this method, keep the following four cases in mind:

** Case 1:** When we go in single direction, i.e. words/digits are arranged either from left to right or right to left. In this case,

**auto filling**of words/digits could take place because some numbers/words arrange themselves. So how do we go about numbering our elements in this case?

**For convenience’s sake, let us think of all the elements being arranged left to right.**

- Number each word/number in the manner shown above as per their order of arrangement in accordance with the pattern depicted in the question. Think of it as a step-by-step process. After each numbering, you need to stop and check.
- After you identify the first element, number it (1). Then identify the second element. Check all the elements to its left. Have you numbered all of them yet? If yes, then number this one (1a). If not, then number it (2). Then identify the third element. Check all the elements to its left. Have you numbered all of them yet? If yes, then this does not get a new step number. If no, then it gets a fresh step number. And the process continues. Here is an illustration.

Step VII is the last step of the input

**Q**. Following the above pattern, how many steps will be required to complete the arrangement for the below given input?

**84 out sown even 35 54 around 46**

**Solution:**

**Input: **In the given illustration, the words/digits are being arranged in the following manner: the lowest digit is arranged at leftmost of the sentence and all others are shifted to the right side as it is and in second step, highest word of dictionary is arranged right of the previously arranged number and so on. The next higher digit and next highest word is arranged in subsequent pair of steps.

Here is how you would go about numbering these elements. Note that underlined elements represent those ones to the left that you haven’t numbered yet.

Here, 6a and 6b are not given further values at the time of filling, as all elements to the left of these two have been filled already. Hence, these two entities are arranged automatically in step 6. In addition, step 6 is the last step of the input, so six steps are required to complete the arrangement.

** NOTE:** Now whichever step is asked in the question, take the part of the solution up to the required step number to get the answer. Arrange the numbered elements according to their labels, and shift the remaining to the right, while leaving their order unchanged.

** NOTE: **If the rearrangement is to be done from the right, the process of checking would be reversed. Now instead of checking to the left, you would have to check to the right to see if there are any unnumbered elements.

** Case 2: **When we go in both directions, with elements filling in from the inside,

**auto filling**could still take place. So we need to take that into account when numbering. Based on which direction the element goes, it is numbered with an L (left) or an R (right) attached to it. When considering items labeled with L, check to see if there are any unlabeled elements to its left and when considering items labeled with R, check to see if there are any unlabeled elements to its right.

Step III is the final step of the rearrangement.

Q. Following the above pattern, how many steps will be required to complete the arrangement for the below given input?

**goat out 34 59 set 75 peon 28**

**Solution:**

**Input:** The rearrangement clearly happens from both directions simultaneously, but from the inside. The fact that the rearrangement is happening from the inside makes a huge difference. The numbers are arranged in ascending order from the left and the words are arranged in descending order of their appearance in the dictionary, but from the right.

Here is how you go about numbering these elements. Note that underlined elements represent those ones to the left of the ‘L’ elements that you haven’t numbered yet. And the italicized elements represent the ones to the right of the ‘R’ elements that you haven’t numbered yet.

Now, it is easy to answer the question based on the numbering. The answer is three steps.

Q. Following the above pattern, what will be the second step after rearrangement for the below given input?

**goat out 34 59 set 75 peon 28**

**Solution:**

The underlined elements represent the remaining elements unchanged in order.

** **** Case 3:** When we go in both directions with elements filling in from the outside, i.e. we place digits/numbers left to the left most word/ right to the right most word. In this case,

**no**

**auto filling**of digits/numbers takes place i.e. each word is numbered separately. Keep in mind the following:

- Number of pairs of words/digits is equal to the number of steps.
- Identify the pattern in the input rearrangement. Then number the elements going left in their pattern order with 1L, 2L, 3L and so on. And number the elements going right in their pattern order with 1R, 2R,3R and so on.
- There is no auto filling, so there is no need to check step by step. The numbering can be done in one go.

STEP V is the last step of the input.

** Q. **Which is the 5^{th} letter from right side in step V of the following input?

**Input:**** **87 when show 14 35 new beat ink 51 28

**Label:** 5L 5R 4R 1L 3L 3R 1R 2R 4L 2L

**Solution:** In the given illustration, the words/digits being arranged in the following manner: in the first step, lowest digit and lowest word in dictionary are placed at left most and right most side respectively, of the string and all other entities are placed as it is. Then in the 2^{nd} step, next lowest digit and word are arranged to the left and right of the previously arranged digit and word simultaneously and so on. Therefore, arrangement is from left to left + right to right.

Here L1, L2 so on are used to represent left side and R1, R2 so on to represent right side.

Hence step 5 of the input is

Step 5: 87 51 35 28 14 beat ink new show when

So 5^{th} from the right side is __‘beat’__

__NOTE__**: **In this case 5^{th} from right is not R5, but R1. So be careful while answering this type of question. Count backwards from the highest number label of that step in such cases.

** Case 4:** In mixed form i.e. both case 1 and 2 are used in one input then both the rules are used for each side

** NOTE:** If pairing of words and digits/words and words/ digits and digits is observed i.e. both are placed simultaneously in each step and in case if one is auto filled & other is not then no step is skipped.