`121426` <- Here, 1 is an alternating repetitive digit.

`523563` <- Here, NO digit is an alternating repetitive digit.

`552523` <- Here, both 2 and 5 are alternating repetitive digits.

`333567` <- Here, 3 is an alternating repetitive digit.

I found `re.findall(r'(?=(\d)\d\1)',P)` as the solution in editorial but not able to understand it.

Edit - Not allowed to use `if` conditions.