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
2023-01-04 04:22:51 [Rampage] Blue.Mary
A BF constant optimization problem. O(T * n^2 * Char) solution can get AC. (n is the length of the string, Char is the ASCII code of the character.)
2015-01-03 05:02:53 Mitch Schwartz
FYI, it seems BF is slower now after upgrade to 1.0.5. (The slowdown might be from different gcc version when compiling bff; the only changes to bff were bug fixes, and after looking again at source differences between 1.0.3.1 and 1.0.5, I don't see anything that would affect speed.)

Last edit: 2015-01-03 07:12:55
2014-06-07 12:46:15 Sandeep Garhwar
Will my 30-second code be fast enough for the challange version of the problem?
2014-06-03 20:39:26 (Tjandra Satria Gunawan)(曾毅昆)
@[themighty] deathsurgeon: Thanks for your appreciation :)
2014-05-28 11:38:53 [themighty] deathsurgeon
wohoo!! nailed it!
@Tjandra, Thank you for the question. Thats the best BF question I've solved till date.

Last edit: 2014-05-28 17:36:16
2013-01-26 11:09:37 (Tjandra Satria Gunawan)(曾毅昆)
@Mostafa 36a2: Awesome solution... new concept :-D Congratulations..
2013-01-25 20:20:27 Mostafa 36a2
Oh thanks GOD !
i make a good time .. a little bit near to Mitch , someday i gonna beat him :D
2013-01-25 16:24:24 Mostafa 36a2
@Tjandra Satria Gunawan: thanks for the info
also thanks for the problem ,it was really HARD :D ,i learned a lot from it
Thank you very much
best regards ;)
2013-01-25 13:44:59 (Tjandra Satria Gunawan)(曾毅昆)
@Mostafa 36a2: Be careful outputing too many/too less '\n' or 'space' it will cause WA because this problem is using exact judge, check again your output formating, you are very near ;-)

Last edit: 2013-01-25 13:46:52
2013-01-11 10:46:27 (Tjandra Satria Gunawan)(曾毅昆)
Congratulations Mitch Schwartz, your BF code is ~4x faster than mine :-) You did very very good trick/idea...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.