题目描述

(Optional, Palindromes) A palindrome is a string that is spelled the same way forward and backward. Examples of palindromes include “radar” and “able was i ere i saw elba” Write a recursive function test Palindrome that returns true if a string is a palindrome, and false otherwise. Note that like an array, the square brackets ([]) operator can be used to iterate through the characters in a string. Please note that there is a '\n' at the end of each line.

Important Note: You must use the code from 备注 to get input. And the output in the VS might be different to the OJ. Test your code in the OJ!
Another Note: This question is optional, you are not required to finish it.


输入格式

The first line of input consist of the number of strings (ranges from 1 to 10).
Each line below the first line is a string(include spaces).


输出格式


样例数据

输入

3
radar
able was i ere i saw elba
test

输出

"radar" is a palindrome
"able was i ere i saw elba" is a palindrome
"test" is not a palindrome

备注

You can use the following code to get input:

int n;
char blank;
cin>>n;//number of testing samples
cin.get(blank); //clear null
cin.get(blank); //clear '\n'
for(int i=0;i < n;i++)
{
char arr[100];
cin.getline(arr, 100);
arr[strlen(arr)-1]='\0';
//Below you can write code to determine if arr is a palindrome
}


操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解