-Code
right = "yuiophjklnm"
left = "qwertasdfgzxcvb"
while True:
s = input()
if s == "#":
break
res = 0
hand = "r" if s[0] in right else "l"
for w in s:
if w in right and hand == "l":
res += 1
hand = "r"
elif w in left and hand == "r":
res += 1
hand = "l"
print(res)
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 31282번 HUNTING DOG (0) | 2024.01.23 |
---|---|
[백준/파이썬] 8965번 Circular Sequence (0) | 2024.01.22 |
[백준/파이썬] 21143번 Magic Trick (0) | 2024.01.20 |
[백준/파이썬] 15035번 I Work All Day (0) | 2024.01.19 |
[백준/파이썬] 29823번 Pakirobot Manhattanis (0) | 2024.01.18 |