Palindromic FizzBuzz
InterviewTime limit1sMemory limit512 MB
Print every integer from S to E, replacing any palindromic number with the string Palindrome!.
- Level
Easy3 of 10
- Topics
- Implementation, Math, String, Brute force
- Solved
- No attempts yet
Problem
Gug finds the classic FizzBuzz problem too boring, so he decided to add a twist to it. Print a list of consecutive integers, one per line, starting with S on the first line and ending with E on the last line. Since Gug likes palindromes, print the string Palindrome! in place of an integer if that integer is palindromic, that is, if it reads the same forwards and backwards.
Input
Your program reads from standard input. The input is a single line containing two integers, S and E.
Output
Your program writes to standard output. Print E − S + 1 lines, each containing either an integer or the string Palindrome! if that integer is palindromic.
Constraints
- 1 ≤ S ≤ E ≤ 10^18
- E − S + 1 ≤ 10^5