FAST_BF - The BrainFast Processing! Classical version

Warning: Only Brainf**k language is allowed.

After I solve this problem in 0.00s using BF , I have an idea to set new BF problems, now here I come Wink

The task is simple, given a (1="length of string"=1000) just check if the string is palindrome or not.

The string contains character in range ASCII(32)=char=ASCII(126)

Input

The first line, there is an integer T(1=T=1000) denoting number of test cases then you should process only next T lines, each line is a terminated by new line character ('\n') ASCII(10)

Output

For each test case:

if <string> is palindrome, output: "<string>" is palindrome

else, output: "<string>" is not palindrome

remember to put '\n' after each test case

Example

Input:
11
abba
abba 
 abba
 abba 
Tjandra Satria Gunawan
Tjandra Satria Gunawan nawanuG airtaS ardnajT
()
((
kasur ini rusak
Kasur ini rusak
x
Don't process this case because T is 11
And also this problem use exact judge so be careful put space and '\n'
Only brainf**k is allowed
and soure limit is 1500 bytes

Output:
"abba" is palindrome
"abba " is not palindrome
" abba" is not palindrome
" abba " is palindrome
"Tjandra Satria Gunawan" is not palindrome
"Tjandra Satria Gunawan nawanuG airtaS ardnajT" is palindrome
"()" is not palindrome
"((" is palindrome
"kasur ini rusak" is palindrome
"Kasur ini rusak" is not palindrome
"x" is palindrome

Time limit ~2x My fastest BF code

If you TLE here, you may try this problem first.

See also: Another problem added by Tjandra Satria Gunawan


Added by:Tjandra Satria Gunawan
Date:2013-01-10
Time limit:100s
Source limit:1500B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BF
Resource:The Mirror of Galadriel Problem plus my own idea ;-)

hide comments
2013-01-11 00:28:28 (Tjandra Satria Gunawan)(曾毅昆)
Just Info: In normal programming language like C, Python, Pascal, etc.. This problem can be computed in O(n) per case, but in Brainf**k the complexity is O(n^2) per case because Brainf**k doesn't have build in compare operator.. And probably this problem is the hardest Brainf**k problem on SPOJ... ;-)
2013-01-10 18:09:05 (Tjandra Satria Gunawan)(曾毅昆)
@Aditya Pande: "Every string terminated with '\n' ASCII(10)", so there always \n at the end of string, and no string with length 0. good luck :-)
2013-01-10 18:00:45 Aditya Pande
about the input file,
does the last line end in EOF or it ends in \n and then EOF....
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.