Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 628 Bytes

1050.md

File metadata and controls

28 lines (23 loc) · 628 Bytes

Python script:

with open("input.txt","r") as file:
    input = file.read()
    # print(input)

    st=[0]
    for c in input:
        match c:
            case "-":
                st[-1]-=1
            case "+":
                st[-1]+=1
            case ">":
                st = st[1:len(st)] + st[0:1]
            case "<":
                st = st[-1:len(st)]+st[0:-1]
            case "@":
                st[-1],st[-2] = st[-2],st[-1]
            case ".":
                st.append(st[-1])
    
    print(''.join([chr(num) for num in st]))