File tree
Expand file treeCollapse file tree1 file changed
+36
-0
lines changed Expand file treeCollapse file tree1 file changed
+36
-0
lines changed Original file line number | Diff line number | Diff line change |
---|
|
| 1 | +#!/bin/python3 |
| 2 | + |
| 3 | +import math |
| 4 | +import os |
| 5 | +import random |
| 6 | +import re |
| 7 | +import sys |
| 8 | + |
| 9 | +# Complete the funnyString function below. |
| 10 | +def funnyString(s): |
| 11 | +r=s[::-1] |
| 12 | +l1=[ord(i) for i in r] |
| 13 | +l2=[ord(j) for j in s] |
| 14 | +l3= [ abs(l1[i+1]-l1[i]) for i in range(0,len(l1)-2)] |
| 15 | +l4= [ abs(l2[i+1]-l2[i]) for i in range(0,len(l2)-2)] |
| 16 | +for i,j in zip(l3,l4): |
| 17 | +if i!=j: |
| 18 | +return "Not Funny" |
| 19 | +return "Funny" |
| 20 | +#for i,j in r,s: |
| 21 | +# l1.append(ord(i)) |
| 22 | +# l2.append(ord(j)) |
| 23 | + |
| 24 | +if __name__ == '__main__': |
| 25 | +fptr = open(os.environ['OUTPUT_PATH'], 'w') |
| 26 | + |
| 27 | +q = int(input()) |
| 28 | + |
| 29 | +for q_itr in range(q): |
| 30 | +s = input() |
| 31 | + |
| 32 | +result = funnyString(s) |
| 33 | + |
| 34 | +fptr.write(result + '\n') |
| 35 | + |
| 36 | +fptr.close() |
You can’t perform that action at this time.
0 commit comments