Company: Wipro_14nov
Difficulty: medium
The 555 Decoder Description A friend hands you a set of input2 positive integers in the array input1 , encoded with the 555 decoder . Decode the set with the following three steps and report the result. Step 1 -- decode each number. A number takes part only when it has exactly three digits. For such a number, replace every digit d by |5 - d| and read the three replacement digits as a number, keeping their order. A number that does not have exactly three digits decodes to 0 . Step 2 -- reduce each decoded number to one digit. Add up the digits of the decoded number; if the result still has more than one digit, add up its digits again, and keep going until a single digit is left. This is the digital root, and the digital root of 0 is 0 . Step 3 -- add the single digits. The answer is the sum of the single digits produced in step 2. Complete the function the555Decoder in the editor below. Function Signature int the555Decoder(vector<int> input1, int input2); Input The input is read f