import res = "AAANAANABNA"pattern = r"(?<!A)(?=(A+N+A+))"print(re.findall(pattern, s))
Standard input is empty
['AAANAA', 'AANA']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!