# AFB tighten 8 
# SC loosen 4 
# H loosen 2 
# GDPE tighten 9



code = input()

name = ""
sign = ""
num = ""

i = 0
n = len(code)

while i < n:
    ch = code[i]
    
    if ch.isalpha():  # 문자일 때
        name = name + ch
        i += 1

    elif ch == "+" or ch == "-":  # 부호일 때
        sign = ch
        i += 1

        # 부호 뒤에 숫자 모으기
        num = ""
        while i < n and code[i].isdigit():
            num += code[i]
            i += 1

        # 동작 결정
        if sign == "+":
            action = "tighten"
        else:
            action = "loosen"

        # 출력
        print(name + " " + action + " " + num)

        # 다음 명령을 위해 초기화
        name = ""
        sign = ""
        num = ""

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: