def main(): t = int(raw_input()) for _ in xrange(t):
s = raw_input().strip()
s_len = len(s)
is_funny = True
for i in xrange(1, len(s)/2+1): # 比较一半儿就行了,因为是对称的
if abs(abs(ord(s[i])-ord(s[i-1]))) != abs(ord(s[s_len-1-i])-ord(s[s_len-i])):
is_funny = False
break if is_funny:
print "Funny"
else:
print "Not Funny" main()
Link:
https://www.hackerrank.com/challenges/funny-string
学习:
比较一半
中心对称的字符串