:
:
import re
def Capitalize(text: str):
ex = re. compile(r"[A-Za-zА-Яа-я]+")
words = ex. findall(text)
rest = ex. split(text)
result = []
for i in range(0, len(words)):
result. append(rest[i])
result. append(words[i]. capitalize())
result. append(rest[len(rest)-1])
return "". join(result)
S = "a-bb-ccc In a hole in the ground there lived a hobbit" # input("Введи строку: ")
print(Capitalize(S))