Skip to content

Commit 5b19751

Browse files
committed
[2025-05-08] BOJ 4597번 풀이
1 parent 93330e8 commit 5b19751

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

BOJ/string/BOJ_4597.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
while True:
2+
word = input()
3+
if word == '#':
4+
break
5+
one = 0
6+
result = ''
7+
for i in range(len(word)):
8+
if word[i] == 'e':
9+
if one % 2 == 1:
10+
result += '1'
11+
else:
12+
result += '0'
13+
elif word[i] == 'o':
14+
if one % 2 == 1:
15+
result += '0'
16+
else:
17+
result += '1'
18+
else:
19+
result += word[i]
20+
if word[i] == '1':
21+
one += 1
22+
print(result)

0 commit comments

Comments
 (0)