백준 13939번: Imena #Python

ColorlessDia·2024년 3월 2일

algorithm/baekjoon

목록 보기
102/807
N = int(input())
line = input()

start_point = 0

sentence_list = []

for i, char in enumerate(line):
    if char in ['.', '?', '!']:
        sentence_list.append(line[start_point:i].split())

        start_point = i + 2

for sentence in sentence_list:
    count = 0
    
    for word in sentence:
        if word[0].isupper() and word.isalpha():
            count += 1

    print(count)

0개의 댓글