Symmetric Numbers
InterviewTime limit1sMemory limit1024 MB
Given the first three digits A, B, and C, print the smallest symmetric number that starts with them.
- Level
Easy3 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
A number is called symmetric (mirror) if its first digit equals its last digit, its second digit equals its second-to-last digit, and so on. In Figure 1 (a), the number 12 and its mirror image form the symmetric number 1221.

Fig. 1
Figure 1 (b) shows examples of symmetric numbers. Symmetric numbers can have an even number of digits or an odd number of digits.
Given three digits A, B, and C, write a program sym that prints the smallest symmetric number whose first three digits are A, B, and C.
Input
The first line contains the three digits A, B, and C, separated by single spaces.
Output
Print the symmetric number on one line. Do not put spaces between the digits of the answer.