sentence = input("Речення: ")
max_space_count = 0
space_count = 0
for char in sentence:
if char == " ":
space_count += 1
if space_count > max_space_count:
max_space_count = space_count
else:
print(max_space_count)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
sentence = input("Речення: ")
max_space_count = 0
space_count = 0
for char in sentence:
if char == " ":
space_count += 1
if space_count > max_space_count:
max_space_count = space_count
else:
space_count = 0
print(max_space_count)