import reprint (re.subn("(a)(n)", r"\2\1", "banana"))
Standard input is empty
('bnanaa', 2)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!