Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. a=int(input())
  2. slovo=input()
  3. count=0
  4. slovo2=slovo[::-1]
  5. if slovo==slovo2:
  6. count=0
  7. else:
  8. while slovo!=slovo2:
  9. if count>=a:
  10. count=-1
  11. break
  12. word=slovo[:1]
  13. slovo=slovo[1:]
  14. slovo+=word
  15. count+=1
  16. print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement