something I’m working on right now
def shrink():
mov (r8, 0) # index
mov (r9, r1) # input -> hold
geti (r9, 0) # last character
mov (r10, 0) # count
mov (r2, "") # result
push (r1)
call (len)
pop (r11) # length
def add_char():
# convert it into a character first
add (r10, 32)
push (r10)
call (chr)
pop (r10)
# add it to the result
add (r2, r9)
add (r2, r10)
# reset everything
mov (r9, r3)
mov (r10, 0)
while true:
mov (r3, r1)
geti (r3, r8)
cmp (r9, r3)
if neql:
goto (add_char)
# increment
add (r10, 1)
add (r8, 1)
# check if it's the right size
cmp (r8, r11)
if eql:
goto (add_char)
break
cursed python