FAST_BF2 - The BrainFast Processing! Challenge 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 <string>(1≤"length of string"≤10) just check if the string is palindrome or not.

The string contains character in range ASCII(97)≤char≤ASCII(122) (lower case alphabet)

Input

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

Output

For each test case:

if <string> is palindrome, output: YES

else, output: NO

Example

Input:
2
aba
ab
Output:
YES
NO

Score

Score is length of your source.

If you TLE here, you may try this problem first. If you got AC in 0.00s there you shoud got AC in 0.00s here too Wink

See also: Another problem added by Tjandra Satria Gunawan


Added by:Tjandra Satria Gunawan
Date:2013-01-10
Time limit:0.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-17 17:03:47 Mitch Schwartz
@Mostafa: It sounds like you are trying to get AC with an incorrect solution; why would asdsda or 123123 pose any problem?

@Tjandra: There is some weakness in the test data that allowed me to save 11 bytes altogether, because

(1) T is always 100. (save 10 bytes)
(2) There is nothing in the test data like "aba" followed by "a". (save 1 byte)

Rejudging for this problem is awkward since AC or TLE is up to chance; I was leaning toward not bringing this to your attention but decided to anyway.

Ans: New test data added and all submissions rejudged, thanks for the info :-D

Last edit: 2013-01-17 17:00:40
2013-01-17 17:03:47 Mostafa 36a2
why i get WA ? ;)
id=8520204
is there sometest cases to avoid freak solutions!
is ther a testcases like asdsda or 123123
if my algo works maybe i can beat Mitch :D
but seems it wont work:)
i'm waiting your answer @Tjandra :)
thank you
Ans: check with this case: "yoyo" this is not palindrome... and some other mistake (find it by yourself :-P)...

Last edit: 2013-01-17 16:49:54
2013-01-17 17:03:47 Mitch Schwartz
Thanks! TLE/AC ratio seems reasonable now, at least for my current setup. :)

Last edit: 2013-01-11 14:05:27
2013-01-17 17:03:47 (Tjandra Satria Gunawan)(曾毅昆)
@Mitch Schwartz: Sorry about junk test data, Accidently I put two '\n' after last test case.. Also I forgot about server instability, now I've updated the time limit and fix test data and rejudge all submissions.. Sorry for inconvenience..
@Aditya Pande: Now time limit updated to 0.009s, enjoy! ;-)
2013-01-17 17:03:47 Aditya Pande
apparently the time limit is very strict if mitch is having a hard time avoiding TLE...

Last edit: 2013-01-11 08:18:49
2013-01-17 17:03:47 Mitch Schwartz
Does input contain junk data after the last case?

Edit: Yes it seems so.

It seems the time limit is not appropriate. According to classical version, my code is significantly faster than yours, yet I got 3 TLEs before AC, server instability makes it ridiculous.

Adapting my approach to take only the first T test cases and ignore junk after them was awkward... maybe some will find the requirement interesting, for me it was more of an annoyance.

Anyway, thanks for more BF problems.

Last edit: 2013-01-11 06:45:49
2013-01-17 17:03:47 (Tjandra Satria Gunawan)(曾毅昆)
@Aditya Pande: don't worry, it's possible to got AC here with this constraints: (length of string less than 10 and number of test cases less than 100) I've tested it with my own BF code. good luck ;-)
2013-01-17 17:03:47 Aditya Pande
the time limit makes me nervous :(
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.