Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. while True:
  2.     line = input()
  3.     state = ''
  4.     if line == 'end':
  5.         break
  6.     for i in range(1, len(line)//2+1):
  7.         #print(i, line[0:i])
  8.         if line[0:i] == line[len(line)-i:len(line)]:
  9.             state = line[0:i]
  10.     #print(state, 'l', line)
  11.     line = line[len(state):-len(state)]
  12.     if line != '' and state !='':
  13.         print('{}{}{}'.format(line,state,line))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement