Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- REPEATER = re.compile(r"(.+?)\1+$")
- def repeated(s):
- match = REPEATER.match(s)
- return match.group(1) if match else -1
- n=int(input())
- for i in range(0,n):
- s=str(input())
- print(repeated(s))
Add Comment
Please, Sign In to add comment