import re pattern = r"(S(?<!\S.).*?)\s*S(?<!\S.)"s = "Stack, Code and StackOverflow"m = re.search(pattern, s)if m: print(m.group(1))
Standard input is empty
Stack, Code and
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!