WIPRO CODING TEST PROGRAM
Date : Sep 17, 2017
Please write a program by using the following conditions
Encoding Three Strings: Anand was assigned the task of coming up with an encoding mechanism for any given strings.He has come up with the below plan.
STEP ONE: Given any three Strings,break each string into 3 parts each.
FOR EXAMPLE-if the three strings are as below-
"john" should be split into "j","oh","n" as FRONT,MIDDLE And END parts respectively.
"johny" should be split into "jo","h","ny" as FRONT,MIDDLE And END parts respectively.
"janardhan" should be split into "jan","ard","han" as FRONT,MIDDLE And END parts respectively.
i.e. if the no.of characters in the string are in multiples of 3,then each split-part will contain equal no.of characters,as seen in the example of "janardhan"
if the no.of characters in the string are NOT in multiples of 3,and if there is one character more than multiple of 3,then the middle part will get the extra character,as seen in the example of "john"
if the no.of characters in the string are NOT in multiples of 3,and if there are two characters more than multiple of 3,then the FRONT and END part will get the equal characters,as seen in the example of "johny".
output1=FRONT part of INPUT1 +MIDDLE part of INPUT2+END part of INPUT3;
output2=MIDDLE part of INPUT1 +END part of INPUT2+FRONT part of INPUT3;
output3=END part of INPUT1 +FRONT part of INPUT2+MIDDLE part of INPUT3;
For example,for the above specified example input strings,
STEP THREE:Process the resulting output strings based on the output-processing rule.
After the above two steps,we will now have three output strings.Further processing is required only for the third output string as per below rule-"Toggle the case of each character in the String", i.e. in the third output string,all lower-case characters should be made upper-case and vice-versa.
For example,for the above example strings, output3 is "nJoard",so after appliying the toggle rule,output3 should become "NjOARD".
FINAL RESULT:-The three output strings after applying the above three steps is the final result. i.e. for the above example,
Anand approaches you to help him write program that would do the above mentioned processing on any given three strings and generate the resulting three output strings.
The given function's three parameters,input1,input2 and input3 represent the three given input strings.The function should do the processing on these three input strings and return a "Result" object/struct with the three output strings assigned within it.