본문 바로가기

백준/Bronze 3

백준 3028 파이썬

728x90
ball = [1,0,0]

class Compare:

    tmp=''

    def A(ball):

        tmp = ball[0] 
        ball[0] = ball[1] 
        ball[1] = tmp 
        return ball

    def B(ball):

        tmp = ball[1] 
        ball[1] = ball[2] 
        ball[2] = tmp 
        return ball

    def C(ball):

        tmp = ball[0] 
        ball[0] = ball[2] 
        ball[2] = tmp 
        return ball



alphabet=input() 


for i in alphabet: 
    if i == 'A': 
        Compare.A(ball) 
    elif i =='B': 
        Compare.B(ball) 
    else: 
        Compare.C(ball)

print(ball.index(1)+1)

'백준 > Bronze 3' 카테고리의 다른 글

백준 13698 파이썬  (0) 2021.01.18
백준 9517 파이썬  (0) 2020.12.30
백준 2985 파이썬  (0) 2020.12.30
백준 2863 파이썬  (0) 2020.12.30
백준 2511 파이썬  (0) 2020.12.30