Question: python programming Stark is a math teacher who loves to challenge his students with puzzles and brain teasers. One day, he decides to set an

python programming

python programming Stark is a math teacher who loves to challenge his

students with puzzles and brain teasers. One day, he decides to set

an extra credit question for his class. He has given the students

Stark is a math teacher who loves to challenge his students with puzzles and brain teasers. One day, he decides to set an extra credit question for his class. He has given the students a number and asked them to add a minimum number of digits to the end of the given number in such a way that the number would be the same when viewed from both the left and right sides. The resultant number will be the answer to the question. Help the students to answer this question. Given a number N that Stark has given to the students. Write a program that reads a number - N and prints the answer to this question by adding a minimum number of digits to the end arf the given number so that the number would be the same when viewed from both the left and right sides: Input The input will be a single line containing an integer representing the number N given to the students. Output The output should be a single line containing an integer obtained by adding some minimum number of digits to the end of the given number so that the number would be the same when viewed from both the left and right sides. Explanation For example, if the given N=1322, - After adding the digit 3 to the end of the given number, the number becomes 13223. - After adding the digit 1 to the end of the number, the number becomes 132231. - The resultant number 132231 looks the same when viewed from both the left and right sides. The output should be 132231. For example, if the given N=456, - After adding the digit 5 to the end of the given number, the number becomes 4565 . - After adding the digit 4 to the end of the number, the number becomes 45654. - The resultant number 45654 looks the same when viewed from both the left and right sides. The output should be 45654 . Sample Input 1 The output should be 45654 . Sample Input 1 Sample Output 1 132231 Sample Input 2 Sample Output 2 45654

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!