import re def srp(s): return re.search(r'(.+?)\1+', s).group(1) print srp('dabcdbcdbcdd')print srp('cbabababac')
Standard input is empty
bcd ba
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!