pr3_skriptspr_teamF_s2/PyCharmProjekte/s2_a2.py

10 lines
178 B
Python

#Aufgabe 2
import re
s1 = 'If the the problem is textual, use the the re module'
pattern = r'\b(\w+)( \1\b)+'
s2 = re.sub(pattern, r'\1', s1)
print('s1:', s1)
print('s2:', s2)