code = input()

name = ''
sign = ''
num = ''
i = 0
length = len(code)

while i < length:
    ch = code[i]
    
    if ch.isalpha():
        name += ch
        i += 1
    elif ch == '+' or ch == '-':
        sign = ch
        i += 1
        num = ''
        while i < length 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: