Great news! The jRobot Corporation, widely celebrated for its self-vacuuming Zoomba robot, is on the verge of completing its prototype LISA (Lactose Intolerant Super Automaton) robot, a friendly, selflearning machine that is sure to win even the most skeptical of technophobes over with its human-like charms .But the research team seems to have run into a slight snag: while the rate of LISA’s emotional development is off the charts, she has formed an odd affinity for look-say numbers, and the rest of her mathematical processes have shut down.
LISA is well aware of this problem and is dangerously close to self-destructing in desperation. To prevent this catastrophe from occurring, you have been hired to repair LISA’s glitch.Clearly, the best course of action is to reverse LISA’s fondness for looksay numbers by having her develop an attachment for “look-sayreverse” numbers as well and having the attachments cancel each other out. To introduce these numbers to her, you have been asked to generate the n-th look-say-reverse number. Are you up to the task?
The first look-say-reverse numbers are 1, 11, 12, 2111, 1321, and 11213111, . If we know a look-say-reverse number, we can get the next one by splitting the number into consecutive runs of identical digits (so 11213111 becomes “11 2 1 3 111”), saying how many of each digit there are (e.g., "two 1, one 2, one 1, one 3, three 1"), writing this down as a new number ("2112111331"), and reversing it (to get 1331112112).
LISA is well aware of this problem and is dangerously close to self-destructing in desperation. To prevent this catastrophe from occurring, you have been hired to repair LISA’s glitch.Clearly, the best course of action is to reverse LISA’s fondness for looksay numbers by having her develop an attachment for “look-sayreverse” numbers as well and having the attachments cancel each other out. To introduce these numbers to her, you have been asked to generate the n-th look-say-reverse number. Are you up to the task?
The first look-say-reverse numbers are 1, 11, 12, 2111, 1321, and 11213111, . If we know a look-say-reverse number, we can get the next one by splitting the number into consecutive runs of identical digits (so 11213111 becomes “11 2 1 3 111”), saying how many of each digit there are (e.g., "two 1, one 2, one 1, one 3, three 1"), writing this down as a new number ("2112111331"), and reversing it (to get 1331112112).
Input Format
The input consists of a single integer n.
Sample Input
4
Output Format The output should consists of a string s on one line, representing the n-th look-say-reverse number.
Sample Output
2111
You must be logged in to submit a solution.