Company: IBM
Difficulty: medium
Hidden Text Encoding Algorithm In a particular text encoding algorithm, codes are hidden within plain text. The steps to extract the code is as follows: Find the length of the given text and factorize this length to determine its factors. For example, if the length is 10 the factors are 1, 2, 5, 10 Use these factors as positions and find the characters in the text that come in that location. For example, in the case of 10, find the 1st, 2nd, 5th and 10th characters If the character at a particular position is a space character, pick the character next to it. Print these characters in the same order to get the hidden code Given a line of text, the program should: Determine the hidden code using the steps given above and print it Print Invalid input if any of the constraints mentioned in the constraints section is violated Assumptions Assume that there are no consecutive space characters Input Format A single line of text containing the encoded message. Output Format The decoded hidden m