sudonitesh

cogniable_assignment

Apr 30th, 2019
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. t = int(input())
  2. while t>0:
  3.     s = input()
  4.     i = 0
  5.     l = []
  6.  
  7.     while i < len(s):
  8.         j = i
  9.         k = 0
  10.         while j < len(s):
  11.  
  12.             st1 = s[k:j+1]
  13.             st2 = st1[::-1]
  14.  
  15.             if st1 == st2:
  16.                 if st1 not in l:
  17.                     l.append(st1)
  18.  
  19.             k += 1
  20.             j += 1
  21.         i += 1
  22.     print(len(l))
  23.  
  24.     t -= 1
Add Comment
Please, Sign In to add comment