Joseph's team has been assigned the task of creating user-ids for all participants of an online gaming competition. Joseph has designed a process for generating the user-id using the participant's First_Name, Last_Name, PIN code, and a number N. The process defined is as below:
Step 1: Compare the lengths of First_Name and Last_Name of the participant.
The one that is shorter will be called "Smaller Name" and the one that is longer will be called the "Longer Name".
If both are of equal length, then the name that appears earlier in alphabetical order will be called "Smaller Name" and the name that appears later will be called the "Longer Name".
Step 2: The user-id should be generated as below:
Last Letter of the longer name + Entire word of the smaller name + Digit at position N in the PIN when traversing from left to right + Digit at position N in the PIN when traversing from right to left.
Step 3: Toggle the alphabets of the user-id generated in step 2 (i.e., upper-case alphabets should become lower-case and lower-case alphabets should become upper-case).
Example:
First_Name = Rajiv
Last_Name = Roy
PIN = 560037
N = 6
Explanation:
Shorter name is "Roy" (length 3), Longer name is "Rajiv" (length 5).
Last letter of longer name = 'v'. Entire smaller name = "Roy". 6th digit from left in PIN = '7'. 6th digit from right in PIN = '5'. Generated string: vRoy75