fork download
  1. # your code goes here
  2. t=int(input())
  3. for _ in range(t):
  4. s=input()
  5. n=len(s)
  6. c=0
  7. for i in range(n-1):
  8. if(s[i]==s[i+1]):
  9. c+=1
  10. if(c>0):
  11. print(1)
  12. else:
  13. print(n)
Success #stdin #stdout 0.1s 14124KB
stdin
4
baa
skibidus
cc
ohio
stdout
1
8
1
4