상세 컨텐츠

본문 제목

[파이썬] 백준 1152: 단어의 개수 (구현, 문자열)

백준 연습

by \시엔/ 2021. 8. 28. 20:43

본문

# 단어의 개수
from sys import stdin
word = stdin.readline()
array = word.split(' ')
cnt = 0
for i in array:
    if i == '':
        cnt += 1
    elif i == '\n':
        cnt += 1

print(len(array) - cnt)

관련글 더보기