We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Incorrect Regex
Incorrect Regex
Sort by
recency
|
322 Discussions
|
Please Login in order to post a comment
python 3 solution
python added support for possesive quantifiers (*+,++,?+,{ }+) from python 3.11, but the expected outputs are not updated to align with the updated python version. so we need to handle possesive quantifiers separately.
I solve this problem with Python 2 and raw_string. But in Python 3, I don't know how it's possible cause we always have the SyntaxError with '\'.
Nevertheless, here my code :
Try Like this
import re
T = int(input()) invalid_repeats = ['++', '**', '??', '+', '+', '?', '?', '+?', '??']
for _ in range(T): S = input().strip()
how to solve this code
Accepted solution for python 2