0% found this document useful (0 votes)
76 views1 page

The Reverse Funny: Ascii

The document describes a method to determine if a string is "funny" or not. A string is funny if the absolute difference between the ASCII values of the character at index i in the string and the character at index n-i-1 in the reverse string is the same for all indexes i from 0 to n-1. The input contains test cases with strings, and the output prints "Funny" or "Not Funny" for each string.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views1 page

The Reverse Funny: Ascii

The document describes a method to determine if a string is "funny" or not. A string is funny if the absolute difference between the ASCII values of the character at index i in the string and the character at index n-i-1 in the reverse string is the same for all indexes i from 0 to n-1. The input contains test cases with strings, and the output prints "Funny" or "Not Funny" for each string.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Funny

String
Suppose you have a String, , of length that is indexed from to . You also have some String, ,
that is the reverse of String . is funny if the condition is true for
every character from to .

Note: For some String , denotes the ASCII value of the -indexed character in . The absolute
value of an integer, , is written as .

Input Format

The first line contains an integer, (the number of test cases).


Each line of the subsequent lines contain a string, .

Constraints

Output Format

For each String (where ), print whether it is or on a new line.

Sample Input

2
acxz
bcxz

Sample Output

Funny
Not Funny

Explanation

Test Case 0:



As each comparison is equal, we print .

Test Case 1:
, but
At this point, we stop evaluating (as ) and print .

You might also like