본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 4597번 패리티

by 현장 2022. 8. 5.

-Code

while 1:
    s = input()

    if s == '#':
        break

    if s.count('1') % 2 == 0:
        print(s[:-1] + '0' if s[-1] == 'e' else s[:-1] + '1')
    else:
        print(s[:-1] + '1' if s[-1] == 'e' else s[:-1] + '0')