Ответ:
--- Python 3.8.3 x64 ---
import collections
import re
import string
def ClearString(RawString):
return re.sub(r' +', ' ', re.sub(rf'[{string.punctuation}]|\n', '', RawString))
def main():
RawString = input()
OrigString = RawString
MostCommonWord = collections.Counter(ClearString(RawString).split(' ')).most_common()[0][0]
RedactedString = re.sub(rf'{MostCommonWord}', MostCommonWord[::-1], OrigString)
print(RedactedString)
if __name__ == "__main__":
main()
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
--- Python 3.8.3 x64 ---
import collections
import re
import string
def ClearString(RawString):
return re.sub(r' +', ' ', re.sub(rf'[{string.punctuation}]|\n', '', RawString))
def main():
RawString = input()
OrigString = RawString
MostCommonWord = collections.Counter(ClearString(RawString).split(' ')).most_common()[0][0]
RedactedString = re.sub(rf'{MostCommonWord}', MostCommonWord[::-1], OrigString)
print(RedactedString)
if __name__ == "__main__":
main()
Объяснение: