#31935: python的解法與思路


10730094@ms2.hssh.tp.edu.tw (給開司一份薯片)

學校 : 不指定學校
編號 : 172670
來源 : [180.177.114.33]
最後登入時間 :
2023-01-01 23:20:42

#將數字翻轉
try:
    while(True):
        the_first_is_zero = 0
        Number = input()
        temp_arr = ['0']*100 #列表初始化
        for i in range(len(Number)): #換數字(頭尾調換)
            temp_arr[i] = Number[len(Number)-i-1]
        for j in range(len(Number)): #當頭是0時不能印出來
            if(temp_arr[j] == '0' and the_first_is_zero == 0):
                the_first_is_zero = 0
                continue
            else:
                the_first_is_zero = 1
                print(temp_arr[j],end="")
        if(the_first_is_zero == 0): #每一個元素都是0的話,只印出一個0
            print(0,end="")
        print("")
except EOFError:
    pass