import re s = 'HAPPY'print(re.findall(r'(?=(..))', s))
Standard input is empty
['HA', 'AP', 'PP', 'PY']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!