# check if a string has 2 or more words repeated in a row
import re
strings = [
"Moissanite is naturally occurring silicon carbide and its various crystalline polymorphs. It has the chemical formula SiC and is a rare mineral, discovered by the French chemist Henri Moissan in 1893. Silicon carbide is useful for commercial and industrial applications due to its hardness, optical properties and thermal conductivity.",
"Moissanite is naturally occurring silicon carbide and its various crystalline polymorphs. It has the chemical formula SiC and is a rare mineral, discovered by the French chemist chemist Henri Moissan in 1893. Silicon carbide is useful for commercial and industrial applications due to its hardness, optical properties and thermal conductivity.",
"yes no yes no yes no yes no",
"yes no yes yes no no yes no",
]
def check_strings(strings):
for string in strings:
if re.search(r'\b(\w+)\s+\1\b', string):
print("="*50)
print("Repetitions:", string)
else:
print("="*50)
print("No repetitions:", string)
def main():
check_strings(strings)
if __name__ == '__main__':
main()