from string import digits


def decode(string):
    decoded = ''
    digit_str = ''
    for char in string:
        if char in digits:
            digit_str += char
            continue
        s = char
        if digit_str:
            s = int(digit_str) * s
        decoded += s
        digit_str = ''
    return decoded


def encode(string):
    encoded = ''
    prev = ''
    count = 1
    for char in string:
        if not prev:
            prev = char
            continue
        if char == prev:
            count += 1
            continue
        if count > 1:
            encoded += str(count)
        encoded += prev
        prev = char
        count = 1
    if count > 1:
        encoded += str(count)
    encoded += prev
    return encoded

c41c0f61b2b54525ffb9e3a16f8d9c4817eb1895
<mask token>

<mask token>


def encode(string):
    encoded = ''
    prev = ''
    count = 1
    for char in string:
        if not prev:
            prev = char
            continue
        if char == prev:
            count += 1
            continue
        if count > 1:
            encoded += str(count)
        encoded += prev
        prev = char
        count = 1
    if count > 1:
        encoded += str(count)
    encoded += prev
    return encoded

<mask token>


def decode(string):
    decoded = ''
    digit_str = ''
    for char in string:
        if char in digits:
            digit_str += char
            continue
        s = char
        if digit_str:
            s = int(digit_str) * s
        decoded += s
        digit_str = ''
    return decoded


def encode(string):
    encoded = ''
    prev = ''
    count = 1
    for char in string:
        if not prev:
            prev = char
            continue
        if char == prev:
            count += 1
            continue
        if count > 1:
            encoded += str(count)
        encoded += prev
        prev = char
        count = 1
    if count > 1:
        encoded += str(count)
    encoded += prev
    return encoded

from string import digits


def decode(string):
    decoded = ''
    digit_str = ''
    for char in string:
        if char in digits:
            digit_str += char
            continue
        s = char
        if digit_str:
            s = int(digit_str) * s
        decoded += s
        digit_str = ''
    return decoded


def encode(string):
    encoded = ''
    prev = ''
    count = 1
    for char in string:
        if not prev:
            prev = char
            continue
        if char == prev:
            count += 1
            continue
        if count > 1:
            encoded += str(count)
        encoded += prev
        prev = char
        count = 1
    if count > 1:
        encoded += str(count)
    encoded += prev
    return encoded
