728x90
๐ ๋ฐฑ์ค 10820 - ๋ฌธ์์ด ๋ถ์
๋ฐฑ์ค 10820 - ๋ฌธ์์ด ๋ถ์
โก๏ธ ๋์ ํ์ด
- ๋ฌธ์์ด
n๊ฐ๊ฐ ๋ช ๋ฒ์งธ๊น์ง์ธ์ง ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์try except๋ฅผ ์ฌ์ฉํ๋ค.(except EOFError) - ์๋ฌธ์:
islower(), ๋๋ฌธ์:isupper(), ์ซ์:isdigit(), ๊ณต๋ฐฑ:else - ๊ฐ
count๋์
while True:
try:
lower_case, upper_case, number, blank = 0, 0, 0, 0
for i in input():
if i.islower():
lower_case += 1
elif i.isupper():
upper_case += 1
elif i.isdigit():
number += 1
else:
blank += 1
print(lower_case, upper_case, number, blank)
except EOFError:
break
๋ฐ์ํ
'Algorithm > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [ ํ์ด์ฌ(python) ] ๋ฐฑ์ค 6359 - ๋ง์ทจํ ์๋ฒ (0) | 2021.06.18 |
|---|---|
| [ ํ์ด์ฌ(python) ] ๋ฐฑ์ค 1292 - ์ฝ๊ฒ ํธ๋ ๋ฌธ์ (0) | 2021.06.17 |
| [ ํ์ด์ฌ(python) ] ๋ฐฑ์ค 11723 - ์งํฉ (0) | 2021.06.16 |
| [ ํ์ด์ฌ(python) ] ๋ฐฑ์ค 5086 - ๋ฐฐ์์ ์ฝ์ (0) | 2021.06.16 |
| [ ํ์ด์ฌ(python) ] ๋ฐฑ์ค 16935 - ๋ฐฐ์ด ๋๋ฆฌ๊ธฐ 3 (0) | 2021.06.15 |
๋๊ธ