WRITE A JAVA PROGRAM? Tags: String Problem Description Puan Ruqayyah, Madam Chong and Miss Lela teach their dyslexia students to identify characters. They tested randomly on strings of characters and numbers. They found that a few children get excited when they read certain series of strings. The teachers were curious and began to find out that these kids love strings that have series of characters that can be read similarly from right and from left. There are not that many meaningful words and numbers with such pattern. The teachers are interested to collect these meaningful words and numbers to share with their dyslexia students. Examples of such strings are CIVIC, KAPAK, 2102012 (which is 2nd Oct 2012), 1102011 (which is 1st Oct 2011), among others. Now, you are to help Puan Ruqayyah and her colleagues to select such strings. Write a program that reads in a sequence of characters and determine if it can be read similarly from right and from left. Input The first line of input is an integer N (1 ≤ N ≤ 50) that represents the number of test cases, followed by N lines of input. Each of the input contains a string of alpha-numeric characters. The string will have less than 50 characters. Output For each test case, output a line in the format "Case #x: " where x is the case number (starting from 1), follow by either Yes or No. Sample Input: 3 RACECAR mirror Civic Sample Output: Case #1: Yes Case #2: No Case #3: Yes
WRITE A JAVA PROGRAM?
Tags: | String |
Puan Ruqayyah, Madam Chong and Miss Lela teach their dyslexia students to identify characters. They tested randomly on strings of characters and numbers. They found that a few children get excited when they read certain series of strings. The teachers were curious and began to find out that these kids love strings that have series of characters that can be read similarly from right and from left.
There are not that many meaningful words and numbers with such pattern. The teachers are interested to collect these meaningful words and numbers to share with their dyslexia students. Examples of such strings are CIVIC, KAPAK, 2102012 (which is 2nd Oct 2012), 1102011 (which is 1st Oct 2011), among others.
Now, you are to help Puan Ruqayyah and her colleagues to select such strings. Write a program that reads in a sequence of characters and determine if it can be read similarly from right and from left.
Input
The first line of input is an integer N (1 ≤ N ≤ 50) that represents the number of test cases, followed by N lines of input. Each of the input contains a string of alpha-numeric characters. The string will have less than 50 characters.
Output
For each test case, output a line in the format "Case #x: " where x is the case number (starting from 1), follow by either Yes or No.
Sample Input:
3
RACECAR
mirror
Civic
Sample Output:
Case #1: Yes
Case #2: No
Case #3: Yes
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images