Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('baab') == 'AAAAAAAA'
        >>> apply_pipeline('bababaab') == 'AAAAAAAAAAAAAAAA'
        >>> apply_pipeline('aabaababab') == 'AAAAAAAAAAAAAAAAAA'
        >>> apply_pipeline('ba') == 'AAAA'
        >>> apply_pipeline('bbaabba') == 'AAAAAAAAAAAAAAA'
        >>> apply_pipeline('bbbbbaba') == 'AAAAAAAAAAAAAAAAAAAA'
        >>> apply_pipeline('baba') == 'AAAAAAAA'
        >>> apply_pipeline('bbbbb') == 'AAAAAAAAAAAAAAA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.upper()
    s = s.replace('B', 'aaa')
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baab') == 'AAAAAAAA'
    assert candidate('bababaab') == 'AAAAAAAAAAAAAAAA'
    assert candidate('aabaababab') == 'AAAAAAAAAAAAAAAAAA'
    assert candidate('ba') == 'AAAA'
    assert candidate('bbaabba') == 'AAAAAAAAAAAAAAA'
    assert candidate('bbbbbaba') == 'AAAAAAAAAAAAAAAAAAAA'
    assert candidate('baba') == 'AAAAAAAA'
    assert candidate('bbbbb') == 'AAAAAAAAAAAAAAA'

    # hidden tests
    assert candidate('aababaaaab') == 'AAAAAAAAAAAAAAAA'
    assert candidate('babb') == 'AAAAAAAAAA'
    assert candidate('a') == 'A'
    assert candidate('bbbbaba') == 'AAAAAAAAAAAAAAAAA'
    assert candidate('bbabbbaba') == 'AAAAAAAAAAAAAAAAAAAAA'
    assert candidate('bbabbbbaa') == 'AAAAAAAAAAAAAAAAAAAAA'
    assert candidate('a') == 'A'
    assert candidate('aa') == 'AA'
    assert candidate('aab') == 'AAAAA'
    assert candidate('aabba') == 'AAAAAAAAA'
    assert candidate('aaabaaaaaa') == 'AAAAAAAAAAAA'
    assert candidate('baaa') == 'AAAAAA'
    assert candidate('bbaaab') == 'AAAAAAAAAAAA'
    assert candidate('baabb') == 'AAAAAAAAAAA'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('ababa') == 'AAAAAAAAA'
    assert candidate('a') == 'A'
    assert candidate('aaabba') == 'AAAAAAAAAA'
    assert candidate('abb') == 'AAAAAAA'
    assert candidate('bbaaaaabba') == 'AAAAAAAAAAAAAAAAAA'
    assert candidate('bb') == 'AAAAAA'
    assert candidate('bbaaa') == 'AAAAAAAAA'
    assert candidate('abaabba') == 'AAAAAAAAAAAAA'
    assert candidate('aabbaaabba') == 'AAAAAAAAAAAAAAAAAA'
    assert candidate('abbbbab') == 'AAAAAAAAAAAAAAAAA'
    assert candidate('baaab') == 'AAAAAAAAA'
    assert candidate('ba') == 'AAAA'
    assert candidate('a') == 'A'
    assert candidate('abbabaaaaa') == 'AAAAAAAAAAAAAAAA'
    assert candidate('abbaba') == 'AAAAAAAAAAAA'
    assert candidate('aaaab') == 'AAAAAAA'
    assert candidate('abbb') == 'AAAAAAAAAA'

Input: baab

Output: AAAAAAAA

Input: bababaab

Output: AAAAAAAAAAAAAAAA

Input: aabaababab

Output: AAAAAAAAAAAAAAAAAA

Input: ba

Output: AAAA

Input: bbaabba

Output: AAAAAAAAAAAAAAA

Input: bbbbbaba

Output: AAAAAAAAAAAAAAAAAAAA

Input: baba

Output: AAAAAAAA

Input: bbbbb

Output: AAAAAAAAAAAAAAA

Input: aababaaaab

Output: AAAAAAAAAAAAAAAA

Input: babb

Output: AAAAAAAAAA

Input: a

Output: A

Input: bbbbaba

Output: AAAAAAAAAAAAAAAAA

Input: bbabbbaba

Output: AAAAAAAAAAAAAAAAAAAAA

Input: bbabbbbaa

Output: AAAAAAAAAAAAAAAAAAAAA

Input: a

Output: A

Input: aa

Output: AA

Input: aab

Output: AAAAA

Input: aabba

Output: AAAAAAAAA

Input: aaabaaaaaa

Output: AAAAAAAAAAAA

Input: baaa

Output: AAAAAA

Input: bbaaab

Output: AAAAAAAAAAAA

Input: baabb

Output: AAAAAAAAAAA

Input: aaaa

Output: AAAA

Input: ababa

Output: AAAAAAAAA

Input: a

Output: A

Input: aaabba

Output: AAAAAAAAAA

Input: abb

Output: AAAAAAA

Input: bbaaaaabba

Output: AAAAAAAAAAAAAAAAAA

Input: bb

Output: AAAAAA

Input: bbaaa

Output: AAAAAAAAA

Input: abaabba

Output: AAAAAAAAAAAAA

Input: aabbaaabba

Output: AAAAAAAAAAAAAAAAAA

Input: abbbbab

Output: AAAAAAAAAAAAAAAAA

Input: baaab

Output: AAAAAAAAA

Input: ba

Output: AAAA

Input: a

Output: A

Input: abbabaaaaa

Output: AAAAAAAAAAAAAAAA

Input: abbaba

Output: AAAAAAAAAAAA

Input: aaaab

Output: AAAAAAA

Input: abbb

Output: AAAAAAAAAA


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aaabbb') == 'aaabbb'
        >>> apply_pipeline('baaaabba') == 'bbaaabbb'
        >>> apply_pipeline('aaabba') == 'aaabbb'
        >>> apply_pipeline('baaa') == 'bbaa'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('bba') == 'bbb'
        >>> apply_pipeline('aaabb') == 'aaabb'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.lower()
    s = s.replace('ba', 'bb')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aaabbb') == 'aaabbb'
    assert candidate('baaaabba') == 'bbaaabbb'
    assert candidate('aaabba') == 'aaabbb'
    assert candidate('baaa') == 'bbaa'
    assert candidate('b') == 'b'
    assert candidate('a') == 'a'
    assert candidate('bba') == 'bbb'
    assert candidate('aaabb') == 'aaabb'

    # hidden tests
    assert candidate('aab') == 'aab'
    assert candidate('abbbbabaa') == 'abbbbbbba'
    assert candidate('bbbab') == 'bbbbb'
    assert candidate('bbaabbbaba') == 'bbbabbbbbb'
    assert candidate('abbaabb') == 'abbbabb'
    assert candidate('aa') == 'aa'
    assert candidate('babbbbaabb') == 'bbbbbbbabb'
    assert candidate('baaa') == 'bbaa'
    assert candidate('abbabbba') == 'abbbbbbb'
    assert candidate('abbba') == 'abbbb'
    assert candidate('abbabbbb') == 'abbbbbbb'
    assert candidate('bababab') == 'bbbbbbb'
    assert candidate('abaaa') == 'abbaa'
    assert candidate('baaabbab') == 'bbaabbbb'
    assert candidate('bababbbab') == 'bbbbbbbbb'
    assert candidate('a') == 'a'
    assert candidate('bbba') == 'bbbb'
    assert candidate('abbb') == 'abbb'
    assert candidate('abba') == 'abbb'
    assert candidate('aaabbbbaa') == 'aaabbbbba'
    assert candidate('bbbababba') == 'bbbbbbbbb'
    assert candidate('bababbabba') == 'bbbbbbbbbb'
    assert candidate('aaaba') == 'aaabb'
    assert candidate('babba') == 'bbbbb'
    assert candidate('baaaaba') == 'bbaaabb'
    assert candidate('abaaaabaab') == 'abbaaabbab'
    assert candidate('aababa') == 'aabbbb'
    assert candidate('bbbabbaaa') == 'bbbbbbbaa'
    assert candidate('aaabbaabbb') == 'aaabbbabbb'
    assert candidate('abaabbaa') == 'abbabbba'
    assert candidate('bababa') == 'bbbbbb'
    assert candidate('a') == 'a'

Input: aaabbb

Output: aaabbb

Input: baaaabba

Output: bbaaabbb

Input: aaabba

Output: aaabbb

Input: baaa

Output: bbaa

Input: b

Output: b

Input: a

Output: a

Input: bba

Output: bbb

Input: aaabb

Output: aaabb

Input: aab

Output: aab

Input: abbbbabaa

Output: abbbbbbba

Input: bbbab

Output: bbbbb

Input: bbaabbbaba

Output: bbbabbbbbb

Input: abbaabb

Output: abbbabb

Input: aa

Output: aa

Input: babbbbaabb

Output: bbbbbbbabb

Input: baaa

Output: bbaa

Input: abbabbba

Output: abbbbbbb

Input: abbba

Output: abbbb

Input: abbabbbb

Output: abbbbbbb

Input: bababab

Output: bbbbbbb

Input: abaaa

Output: abbaa

Input: baaabbab

Output: bbaabbbb

Input: bababbbab

Output: bbbbbbbbb

Input: a

Output: a

Input: bbba

Output: bbbb

Input: abbb

Output: abbb

Input: abba

Output: abbb

Input: aaabbbbaa

Output: aaabbbbba

Input: bbbababba

Output: bbbbbbbbb

Input: bababbabba

Output: bbbbbbbbbb

Input: aaaba

Output: aaabb

Input: babba

Output: bbbbb

Input: baaaaba

Output: bbaaabb

Input: abaaaabaab

Output: abbaaabbab

Input: aababa

Output: aabbbb

Input: bbbabbaaa

Output: bbbbbbbaa

Input: aaabbaabbb

Output: aaabbbabbb

Input: abaabbaa

Output: abbabbba

Input: bababa

Output: bbbbbb

Input: a

Output: a


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('bbab') == 'BBAB'
        >>> apply_pipeline('ababaabab') == 'ABABAABAB'
        >>> apply_pipeline('babaaaa') == 'BABAAAA'
        >>> apply_pipeline('abbbbaaa') == 'ABBBBAAA'
        >>> apply_pipeline('babbaabab') == 'BABBAABAB'
        >>> apply_pipeline('aaabbaaabb') == 'AAABBAAABB'
        >>> apply_pipeline('bbbbba') == 'BBBBBA'
        >>> apply_pipeline('aaaabaaba') == 'AAAABAABA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbab') == 'BBAB'
    assert candidate('ababaabab') == 'ABABAABAB'
    assert candidate('babaaaa') == 'BABAAAA'
    assert candidate('abbbbaaa') == 'ABBBBAAA'
    assert candidate('babbaabab') == 'BABBAABAB'
    assert candidate('aaabbaaabb') == 'AAABBAAABB'
    assert candidate('bbbbba') == 'BBBBBA'
    assert candidate('aaaabaaba') == 'AAAABAABA'

    # hidden tests
    assert candidate('baabbbbaa') == 'BAABBBBAA'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('baab') == 'BAAB'
    assert candidate('babbaab') == 'BABBAAB'
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('bbabbbab') == 'BBABBBAB'
    assert candidate('b') == 'B'
    assert candidate('bbba') == 'BBBA'
    assert candidate('baa') == 'BAA'
    assert candidate('bbba') == 'BBBA'
    assert candidate('a') == 'A'
    assert candidate('bbaaabba') == 'BBAAABBA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('baa') == 'BAA'
    assert candidate('baabaabab') == 'BAABAABAB'
    assert candidate('bbbab') == 'BBBAB'
    assert candidate('babbaaba') == 'BABBAABA'
    assert candidate('b') == 'B'
    assert candidate('baababa') == 'BAABABA'
    assert candidate('aababbba') == 'AABABBBA'
    assert candidate('aabab') == 'AABAB'
    assert candidate('aabbbb') == 'AABBBB'
    assert candidate('bbaababbaa') == 'BBAABABBAA'
    assert candidate('aaabb') == 'AAABB'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('aaa') == 'AAA'
    assert candidate('bbaaabbbab') == 'BBAAABBBAB'
    assert candidate('aabbababb') == 'AABBABABB'
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('a') == 'A'
    assert candidate('bbbaabbaba') == 'BBBAABBABA'
    assert candidate('aaaabaaaaa') == 'AAAABAAAAA'

Input: bbab

Output: BBAB

Input: ababaabab

Output: ABABAABAB

Input: babaaaa

Output: BABAAAA

Input: abbbbaaa

Output: ABBBBAAA

Input: babbaabab

Output: BABBAABAB

Input: aaabbaaabb

Output: AAABBAAABB

Input: bbbbba

Output: BBBBBA

Input: aaaabaaba

Output: AAAABAABA

Input: baabbbbaa

Output: BAABBBBAA

Input: abaaa

Output: ABAAA

Input: baab

Output: BAAB

Input: babbaab

Output: BABBAAB

Input: aaabbaa

Output: AAABBAA

Input: bbabbbab

Output: BBABBBAB

Input: b

Output: B

Input: bbba

Output: BBBA

Input: baa

Output: BAA

Input: bbba

Output: BBBA

Input: a

Output: A

Input: bbaaabba

Output: BBAAABBA

Input: baaa

Output: BAAA

Input: baa

Output: BAA

Input: baabaabab

Output: BAABAABAB

Input: bbbab

Output: BBBAB

Input: babbaaba

Output: BABBAABA

Input: b

Output: B

Input: baababa

Output: BAABABA

Input: aababbba

Output: AABABBBA

Input: aabab

Output: AABAB

Input: aabbbb

Output: AABBBB

Input: bbaababbaa

Output: BBAABABBAA

Input: aaabb

Output: AAABB

Input: abaaa

Output: ABAAA

Input: aaa

Output: AAA

Input: bbaaabbbab

Output: BBAAABBBAB

Input: aabbababb

Output: AABBABABB

Input: aaabbaa

Output: AAABBAA

Input: a

Output: A

Input: bbbaabbaba

Output: BBBAABBABA

Input: aaaabaaaaa

Output: AAAABAAAAA


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('abbaaaaaa') == 'ABBAAAAAA'
        >>> apply_pipeline('bb') == 'BB'
        >>> apply_pipeline('bbaabbbbaa') == 'BBAABBBBAA'
        >>> apply_pipeline('baabbba') == 'BAABBBA'
        >>> apply_pipeline('bababaa') == 'BABABAA'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('bbbabbbbb') == 'BBBABBBBB'
        >>> apply_pipeline('bbbbaa') == 'BBBBAA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbaaaaaa') == 'ABBAAAAAA'
    assert candidate('bb') == 'BB'
    assert candidate('bbaabbbbaa') == 'BBAABBBBAA'
    assert candidate('baabbba') == 'BAABBBA'
    assert candidate('bababaa') == 'BABABAA'
    assert candidate('aa') == 'AA'
    assert candidate('bbbabbbbb') == 'BBBABBBBB'
    assert candidate('bbbbaa') == 'BBBBAA'

    # hidden tests
    assert candidate('ab') == 'AB'
    assert candidate('bbabbba') == 'BBABBBA'
    assert candidate('aabbbbbab') == 'AABBBBBAB'
    assert candidate('aaabbaba') == 'AAABBABA'
    assert candidate('a') == 'A'
    assert candidate('aaabbbaaaa') == 'AAABBBAAAA'
    assert candidate('baaabbbaaa') == 'BAAABBBAAA'
    assert candidate('aabbba') == 'AABBBA'
    assert candidate('abbaa') == 'ABBAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('aaab') == 'AAAB'
    assert candidate('a') == 'A'
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('babbba') == 'BABBBA'
    assert candidate('abbbaaa') == 'ABBBAAA'
    assert candidate('aa') == 'AA'
    assert candidate('baaaaba') == 'BAAAABA'
    assert candidate('bbb') == 'BBB'
    assert candidate('aaababbb') == 'AAABABBB'
    assert candidate('abaabaab') == 'ABAABAAB'
    assert candidate('b') == 'B'
    assert candidate('bababaabba') == 'BABABAABBA'
    assert candidate('bba') == 'BBA'
    assert candidate('bbabbba') == 'BBABBBA'
    assert candidate('abaaaa') == 'ABAAAA'
    assert candidate('abbbbab') == 'ABBBBAB'
    assert candidate('bbbbaaabba') == 'BBBBAAABBA'
    assert candidate('babba') == 'BABBA'
    assert candidate('aabbb') == 'AABBB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('aaaaaab') == 'AAAAAAB'

Input: abbaaaaaa

Output: ABBAAAAAA

Input: bb

Output: BB

Input: bbaabbbbaa

Output: BBAABBBBAA

Input: baabbba

Output: BAABBBA

Input: bababaa

Output: BABABAA

Input: aa

Output: AA

Input: bbbabbbbb

Output: BBBABBBBB

Input: bbbbaa

Output: BBBBAA

Input: ab

Output: AB

Input: bbabbba

Output: BBABBBA

Input: aabbbbbab

Output: AABBBBBAB

Input: aaabbaba

Output: AAABBABA

Input: a

Output: A

Input: aaabbbaaaa

Output: AAABBBAAAA

Input: baaabbbaaa

Output: BAAABBBAAA

Input: aabbba

Output: AABBBA

Input: abbaa

Output: ABBAA

Input: baaa

Output: BAAA

Input: aaab

Output: AAAB

Input: a

Output: A

Input: aaabbaa

Output: AAABBAA

Input: baaab

Output: BAAAB

Input: babbba

Output: BABBBA

Input: abbbaaa

Output: ABBBAAA

Input: aa

Output: AA

Input: baaaaba

Output: BAAAABA

Input: bbb

Output: BBB

Input: aaababbb

Output: AAABABBB

Input: abaabaab

Output: ABAABAAB

Input: b

Output: B

Input: bababaabba

Output: BABABAABBA

Input: bba

Output: BBA

Input: bbabbba

Output: BBABBBA

Input: abaaaa

Output: ABAAAA

Input: abbbbab

Output: ABBBBAB

Input: bbbbaaabba

Output: BBBBAAABBA

Input: babba

Output: BABBA

Input: aabbb

Output: AABBB

Input: aaab

Output: AAAB

Input: aaaaaab

Output: AAAAAAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('babababbb') == 'babababbb'
        >>> apply_pipeline('bbbb') == 'bbbb'
        >>> apply_pipeline('babba') == 'babba'
        >>> apply_pipeline('aab') == 'aab'
        >>> apply_pipeline('ba') == 'ba'
        >>> apply_pipeline('baaa') == 'baaa'
        >>> apply_pipeline('baab') == 'baab'
        >>> apply_pipeline('aab') == 'aab'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('aaba', 'bbbb')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babababbb') == 'babababbb'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('babba') == 'babba'
    assert candidate('aab') == 'aab'
    assert candidate('ba') == 'ba'
    assert candidate('baaa') == 'baaa'
    assert candidate('baab') == 'baab'
    assert candidate('aab') == 'aab'

    # hidden tests
    assert candidate('bab') == 'bab'
    assert candidate('bbabbbbaa') == 'bbabbbbaa'
    assert candidate('aabbaaab') == 'aabbaaab'
    assert candidate('ab') == 'ab'
    assert candidate('ababbbbba') == 'ababbbbba'
    assert candidate('aaabaab') == 'abbbbab'
    assert candidate('ba') == 'ba'
    assert candidate('aab') == 'aab'
    assert candidate('aabbbbabbb') == 'aabbbbabbb'
    assert candidate('bbabbbbbaa') == 'bbabbbbbaa'
    assert candidate('ababababb') == 'ababababb'
    assert candidate('abbbababbb') == 'abbbababbb'
    assert candidate('aaab') == 'aaab'
    assert candidate('aaabaaa') == 'abbbbaa'
    assert candidate('abaaabaaab') == 'ababbbbaab'
    assert candidate('b') == 'b'
    assert candidate('aaabaab') == 'abbbbab'
    assert candidate('aba') == 'aba'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('a') == 'a'
    assert candidate('abbbbb') == 'abbbbb'
    assert candidate('aabbbabba') == 'aabbbabba'
    assert candidate('aa') == 'aa'
    assert candidate('bb') == 'bb'
    assert candidate('abbaba') == 'abbaba'
    assert candidate('ba') == 'ba'
    assert candidate('bbbabbaaa') == 'bbbabbaaa'
    assert candidate('abbaa') == 'abbaa'
    assert candidate('aba') == 'aba'
    assert candidate('bbab') == 'bbab'
    assert candidate('aabbbaa') == 'aabbbaa'
    assert candidate('bbbb') == 'bbbb'

Input: babababbb

Output: babababbb

Input: bbbb

Output: bbbb

Input: babba

Output: babba

Input: aab

Output: aab

Input: ba

Output: ba

Input: baaa

Output: baaa

Input: baab

Output: baab

Input: aab

Output: aab

Input: bab

Output: bab

Input: bbabbbbaa

Output: bbabbbbaa

Input: aabbaaab

Output: aabbaaab

Input: ab

Output: ab

Input: ababbbbba

Output: ababbbbba

Input: aaabaab

Output: abbbbab

Input: ba

Output: ba

Input: aab

Output: aab

Input: aabbbbabbb

Output: aabbbbabbb

Input: bbabbbbbaa

Output: bbabbbbbaa

Input: ababababb

Output: ababababb

Input: abbbababbb

Output: abbbababbb

Input: aaab

Output: aaab

Input: aaabaaa

Output: abbbbaa

Input: abaaabaaab

Output: ababbbbaab

Input: b

Output: b

Input: aaabaab

Output: abbbbab

Input: aba

Output: aba

Input: bbbb

Output: bbbb

Input: a

Output: a

Input: abbbbb

Output: abbbbb

Input: aabbbabba

Output: aabbbabba

Input: aa

Output: aa

Input: bb

Output: bb

Input: abbaba

Output: abbaba

Input: ba

Output: ba

Input: bbbabbaaa

Output: bbbabbaaa

Input: abbaa

Output: abbaa

Input: aba

Output: aba

Input: bbab

Output: bbab

Input: aabbbaa

Output: aabbbaa

Input: bbbb

Output: bbbb


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('babaaa') == 'BABAAA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('baba') == 'BABA'
        >>> apply_pipeline('bbbbbaabb') == 'BBBBBAABB'
        >>> apply_pipeline('aabaa') == 'AABAA'
        >>> apply_pipeline('abaaab') == 'ABAAAB'
        >>> apply_pipeline('abbbaaabb') == 'ABBBAAABB'
        >>> apply_pipeline('baabb') == 'BAABB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.lower()
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babaaa') == 'BABAAA'
    assert candidate('a') == 'A'
    assert candidate('baba') == 'BABA'
    assert candidate('bbbbbaabb') == 'BBBBBAABB'
    assert candidate('aabaa') == 'AABAA'
    assert candidate('abaaab') == 'ABAAAB'
    assert candidate('abbbaaabb') == 'ABBBAAABB'
    assert candidate('baabb') == 'BAABB'

    # hidden tests
    assert candidate('abbab') == 'ABBAB'
    assert candidate('bbaaabaa') == 'BBAAABAA'
    assert candidate('ba') == 'BA'
    assert candidate('ba') == 'BA'
    assert candidate('abaababbba') == 'ABAABABBBA'
    assert candidate('ab') == 'AB'
    assert candidate('abaabbbba') == 'ABAABBBBA'
    assert candidate('babaab') == 'BABAAB'
    assert candidate('aaabbaaaba') == 'AAABBAAABA'
    assert candidate('a') == 'A'
    assert candidate('aabb') == 'AABB'
    assert candidate('abaaba') == 'ABAABA'
    assert candidate('ba') == 'BA'
    assert candidate('b') == 'B'
    assert candidate('baababb') == 'BAABABB'
    assert candidate('aaabbaaaaa') == 'AAABBAAAAA'
    assert candidate('baa') == 'BAA'
    assert candidate('aaaaab') == 'AAAAAB'
    assert candidate('aaaaaaa') == 'AAAAAAA'
    assert candidate('baaaa') == 'BAAAA'
    assert candidate('abab') == 'ABAB'
    assert candidate('aa') == 'AA'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('aababb') == 'AABABB'
    assert candidate('bbaab') == 'BBAAB'
    assert candidate('bbabaababb') == 'BBABAABABB'
    assert candidate('abbababb') == 'ABBABABB'
    assert candidate('ba') == 'BA'
    assert candidate('bbbabbb') == 'BBBABBB'
    assert candidate('baa') == 'BAA'
    assert candidate('bbbabbbaab') == 'BBBABBBAAB'
    assert candidate('babbbbbbab') == 'BABBBBBBAB'

Input: babaaa

Output: BABAAA

Input: a

Output: A

Input: baba

Output: BABA

Input: bbbbbaabb

Output: BBBBBAABB

Input: aabaa

Output: AABAA

Input: abaaab

Output: ABAAAB

Input: abbbaaabb

Output: ABBBAAABB

Input: baabb

Output: BAABB

Input: abbab

Output: ABBAB

Input: bbaaabaa

Output: BBAAABAA

Input: ba

Output: BA

Input: ba

Output: BA

Input: abaababbba

Output: ABAABABBBA

Input: ab

Output: AB

Input: abaabbbba

Output: ABAABBBBA

Input: babaab

Output: BABAAB

Input: aaabbaaaba

Output: AAABBAAABA

Input: a

Output: A

Input: aabb

Output: AABB

Input: abaaba

Output: ABAABA

Input: ba

Output: BA

Input: b

Output: B

Input: baababb

Output: BAABABB

Input: aaabbaaaaa

Output: AAABBAAAAA

Input: baa

Output: BAA

Input: aaaaab

Output: AAAAAB

Input: aaaaaaa

Output: AAAAAAA

Input: baaaa

Output: BAAAA

Input: abab

Output: ABAB

Input: aa

Output: AA

Input: bbbb

Output: BBBB

Input: aababb

Output: AABABB

Input: bbaab

Output: BBAAB

Input: bbabaababb

Output: BBABAABABB

Input: abbababb

Output: ABBABABB

Input: ba

Output: BA

Input: bbbabbb

Output: BBBABBB

Input: baa

Output: BAA

Input: bbbabbbaab

Output: BBBABBBAAB

Input: babbbbbbab

Output: BABBBBBBAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aba') == 'ABA'
        >>> apply_pipeline('baabaa') == 'BAABAA'
        >>> apply_pipeline('baabbb') == 'BAABBB'
        >>> apply_pipeline('ababaab') == 'ABABAAB'
        >>> apply_pipeline('baaabaa') == 'BAAABAA'
        >>> apply_pipeline('bbb') == 'BBB'
        >>> apply_pipeline('aab') == 'AAB'
        >>> apply_pipeline('aaababa') == 'AAABABA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aba') == 'ABA'
    assert candidate('baabaa') == 'BAABAA'
    assert candidate('baabbb') == 'BAABBB'
    assert candidate('ababaab') == 'ABABAAB'
    assert candidate('baaabaa') == 'BAAABAA'
    assert candidate('bbb') == 'BBB'
    assert candidate('aab') == 'AAB'
    assert candidate('aaababa') == 'AAABABA'

    # hidden tests
    assert candidate('aaaaabb') == 'AAAAABB'
    assert candidate('ababaaaabb') == 'ABABAAAABB'
    assert candidate('a') == 'A'
    assert candidate('abab') == 'ABAB'
    assert candidate('b') == 'B'
    assert candidate('bababbbbab') == 'BABABBBBAB'
    assert candidate('bba') == 'BBA'
    assert candidate('a') == 'A'
    assert candidate('bbabbb') == 'BBABBB'
    assert candidate('bbaaaba') == 'BBAAABA'
    assert candidate('bbbbbabbba') == 'BBBBBABBBA'
    assert candidate('bab') == 'BAB'
    assert candidate('bba') == 'BBA'
    assert candidate('bbabba') == 'BBABBA'
    assert candidate('aaabbaaa') == 'AAABBAAA'
    assert candidate('bababaa') == 'BABABAA'
    assert candidate('b') == 'B'
    assert candidate('ababaaa') == 'ABABAAA'
    assert candidate('baaaabaa') == 'BAAAABAA'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('ababbbaab') == 'ABABBBAAB'
    assert candidate('baabaabbaa') == 'BAABAABBAA'
    assert candidate('aaabab') == 'AAABAB'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('aabbabbab') == 'AABBABBAB'
    assert candidate('aaaaaabab') == 'AAAAAABAB'
    assert candidate('ababaa') == 'ABABAA'
    assert candidate('bbbbb') == 'BBBBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aababbaab') == 'AABABBAAB'
    assert candidate('aaaabbaba') == 'AAAABBABA'
    assert candidate('bbbbbb') == 'BBBBBB'

Input: aba

Output: ABA

Input: baabaa

Output: BAABAA

Input: baabbb

Output: BAABBB

Input: ababaab

Output: ABABAAB

Input: baaabaa

Output: BAAABAA

Input: bbb

Output: BBB

Input: aab

Output: AAB

Input: aaababa

Output: AAABABA

Input: aaaaabb

Output: AAAAABB

Input: ababaaaabb

Output: ABABAAAABB

Input: a

Output: A

Input: abab

Output: ABAB

Input: b

Output: B

Input: bababbbbab

Output: BABABBBBAB

Input: bba

Output: BBA

Input: a

Output: A

Input: bbabbb

Output: BBABBB

Input: bbaaaba

Output: BBAAABA

Input: bbbbbabbba

Output: BBBBBABBBA

Input: bab

Output: BAB

Input: bba

Output: BBA

Input: bbabba

Output: BBABBA

Input: aaabbaaa

Output: AAABBAAA

Input: bababaa

Output: BABABAA

Input: b

Output: B

Input: ababaaa

Output: ABABAAA

Input: baaaabaa

Output: BAAAABAA

Input: aaaa

Output: AAAA

Input: ababbbaab

Output: ABABBBAAB

Input: baabaabbaa

Output: BAABAABBAA

Input: aaabab

Output: AAABAB

Input: bbaa

Output: BBAA

Input: aabbabbab

Output: AABBABBAB

Input: aaaaaabab

Output: AAAAAABAB

Input: ababaa

Output: ABABAA

Input: bbbbb

Output: BBBBB

Input: aaa

Output: AAA

Input: aababbaab

Output: AABABBAAB

Input: aaaabbaba

Output: AAAABBABA

Input: bbbbbb

Output: BBBBBB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aaa') == 'aaabaabb'
        >>> apply_pipeline('bb') == 'bb'
        >>> apply_pipeline('aababb') == 'aaabaaab'
        >>> apply_pipeline('aba') == 'aaabb'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('abbbbbabab') == 'aaabaaabaabbb'
        >>> apply_pipeline('bbaabb') == 'aaabaabbb'
        >>> apply_pipeline('abaabaabb') == 'aaabaaabaaabb'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('a', 'bbb')
    s = s.replace('bbb', 'aabb')
    s = s.lower()
    s = s.replace('bbaab', 'a')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aaa') == 'aaabaabb'
    assert candidate('bb') == 'bb'
    assert candidate('aababb') == 'aaabaaab'
    assert candidate('aba') == 'aaabb'
    assert candidate('b') == 'b'
    assert candidate('abbbbbabab') == 'aaabaaabaabbb'
    assert candidate('bbaabb') == 'aaabaabbb'
    assert candidate('abaabaabb') == 'aaabaaabaaabb'

    # hidden tests
    assert candidate('aabb') == 'aaabbb'
    assert candidate('babbbabaa') == 'aaabaaabaabbbb'
    assert candidate('aba') == 'aaabb'
    assert candidate('baaabbbba') == 'aaabaaabaabbbb'
    assert candidate('aababaaa') == 'aaabaaabaaabbb'
    assert candidate('a') == 'aabb'
    assert candidate('baaaaaab') == 'aaabaaabaaabbb'
    assert candidate('bbbaabb') == 'aaabaabbbb'
    assert candidate('ba') == 'aabbb'
    assert candidate('bbabaaaa') == 'aaabaaabaaab'
    assert candidate('ba') == 'aabbb'
    assert candidate('babbbab') == 'aaabaabbbb'
    assert candidate('abaababb') == 'aaabaaabaabbb'
    assert candidate('aabbbb') == 'aaabaabbb'
    assert candidate('bbbbbba') == 'aaabaabb'
    assert candidate('bbb') == 'aabb'
    assert candidate('ab') == 'aabbb'
    assert candidate('abababb') == 'aaabaaabb'
    assert candidate('baaabab') == 'aaabaaabaabb'
    assert candidate('baababa') == 'aaabaaabaabb'
    assert candidate('baaaa') == 'aaabaaabb'
    assert candidate('bbaaa') == 'aaabaabbbb'
    assert candidate('bbba') == 'aaab'
    assert candidate('bbbab') == 'aaabb'
    assert candidate('ba') == 'aabbb'
    assert candidate('aaaaabba') == 'aaabaaabaaabbb'
    assert candidate('abaa') == 'aaabaabbb'
    assert candidate('bbabbbbaba') == 'aaabaaabaabbb'
    assert candidate('aabaaaa') == 'aaabaaabaaabb'
    assert candidate('aaa') == 'aaabaabb'
    assert candidate('bbabbaaab') == 'aaabaaabaabbbb'
    assert candidate('baabbaab') == 'aaabaaabaabbb'

Input: aaa

Output: aaabaabb

Input: bb

Output: bb

Input: aababb

Output: aaabaaab

Input: aba

Output: aaabb

Input: b

Output: b

Input: abbbbbabab

Output: aaabaaabaabbb

Input: bbaabb

Output: aaabaabbb

Input: abaabaabb

Output: aaabaaabaaabb

Input: aabb

Output: aaabbb

Input: babbbabaa

Output: aaabaaabaabbbb

Input: aba

Output: aaabb

Input: baaabbbba

Output: aaabaaabaabbbb

Input: aababaaa

Output: aaabaaabaaabbb

Input: a

Output: aabb

Input: baaaaaab

Output: aaabaaabaaabbb

Input: bbbaabb

Output: aaabaabbbb

Input: ba

Output: aabbb

Input: bbabaaaa

Output: aaabaaabaaab

Input: ba

Output: aabbb

Input: babbbab

Output: aaabaabbbb

Input: abaababb

Output: aaabaaabaabbb

Input: aabbbb

Output: aaabaabbb

Input: bbbbbba

Output: aaabaabb

Input: bbb

Output: aabb

Input: ab

Output: aabbb

Input: abababb

Output: aaabaaabb

Input: baaabab

Output: aaabaaabaabb

Input: baababa

Output: aaabaaabaabb

Input: baaaa

Output: aaabaaabb

Input: bbaaa

Output: aaabaabbbb

Input: bbba

Output: aaab

Input: bbbab

Output: aaabb

Input: ba

Output: aabbb

Input: aaaaabba

Output: aaabaaabaaabbb

Input: abaa

Output: aaabaabbb

Input: bbabbbbaba

Output: aaabaaabaabbb

Input: aabaaaa

Output: aaabaaabaaabb

Input: aaa

Output: aaabaabb

Input: bbabbaaab

Output: aaabaaabaabbbb

Input: baabbaab

Output: aaabaaabaabbb


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('ab') == 'ab'
        >>> apply_pipeline('aabbbbaa') == 'aabbbbaa'
        >>> apply_pipeline('bbbaa') == 'bbbaa'
        >>> apply_pipeline('babbaba') == 'babbaba'
        >>> apply_pipeline('baaaabb') == 'baaaabb'
        >>> apply_pipeline('ab') == 'ab'
        >>> apply_pipeline('bbaaaba') == 'bbaaaba'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'b'
    assert candidate('ab') == 'ab'
    assert candidate('aabbbbaa') == 'aabbbbaa'
    assert candidate('bbbaa') == 'bbbaa'
    assert candidate('babbaba') == 'babbaba'
    assert candidate('baaaabb') == 'baaaabb'
    assert candidate('ab') == 'ab'
    assert candidate('bbaaaba') == 'bbaaaba'

    # hidden tests
    assert candidate('bbbabaa') == 'bbbabaa'
    assert candidate('baaba') == 'baaba'
    assert candidate('bab') == 'bab'
    assert candidate('abaaaa') == 'abaaaa'
    assert candidate('abaababbba') == 'abaababbba'
    assert candidate('aabbaab') == 'aabbaab'
    assert candidate('a') == 'a'
    assert candidate('a') == 'a'
    assert candidate('abaaaab') == 'abaaaab'
    assert candidate('abbbba') == 'abbbba'
    assert candidate('bbab') == 'bbab'
    assert candidate('aaabbbab') == 'aaabbbab'
    assert candidate('abbbaaa') == 'abbbaaa'
    assert candidate('abab') == 'abab'
    assert candidate('baabbbb') == 'baabbbb'
    assert candidate('ababaaaaab') == 'ababaaaaab'
    assert candidate('a') == 'a'
    assert candidate('babaa') == 'babaa'
    assert candidate('bbaababaa') == 'bbaababaa'
    assert candidate('abba') == 'abba'
    assert candidate('aaaaaaa') == 'aaaaaaa'
    assert candidate('aabaabaaa') == 'aabaabaaa'
    assert candidate('babaaa') == 'babaaa'
    assert candidate('b') == 'b'
    assert candidate('bbba') == 'bbba'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('aaababbbb') == 'aaababbbb'
    assert candidate('abaaaaba') == 'abaaaaba'
    assert candidate('abba') == 'abba'
    assert candidate('bbaaababab') == 'bbaaababab'
    assert candidate('baabbbb') == 'baabbbb'
    assert candidate('bb') == 'bb'

Input: b

Output: b

Input: ab

Output: ab

Input: aabbbbaa

Output: aabbbbaa

Input: bbbaa

Output: bbbaa

Input: babbaba

Output: babbaba

Input: baaaabb

Output: baaaabb

Input: ab

Output: ab

Input: bbaaaba

Output: bbaaaba

Input: bbbabaa

Output: bbbabaa

Input: baaba

Output: baaba

Input: bab

Output: bab

Input: abaaaa

Output: abaaaa

Input: abaababbba

Output: abaababbba

Input: aabbaab

Output: aabbaab

Input: a

Output: a

Input: a

Output: a

Input: abaaaab

Output: abaaaab

Input: abbbba

Output: abbbba

Input: bbab

Output: bbab

Input: aaabbbab

Output: aaabbbab

Input: abbbaaa

Output: abbbaaa

Input: abab

Output: abab

Input: baabbbb

Output: baabbbb

Input: ababaaaaab

Output: ababaaaaab

Input: a

Output: a

Input: babaa

Output: babaa

Input: bbaababaa

Output: bbaababaa

Input: abba

Output: abba

Input: aaaaaaa

Output: aaaaaaa

Input: aabaabaaa

Output: aabaabaaa

Input: babaaa

Output: babaaa

Input: b

Output: b

Input: bbba

Output: bbba

Input: bbaa

Output: bbaa

Input: aaababbbb

Output: aaababbbb

Input: abaaaaba

Output: abaaaaba

Input: abba

Output: abba

Input: bbaaababab

Output: bbaaababab

Input: baabbbb

Output: baabbbb

Input: bb

Output: bb


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('abbabbabab') == 'ABBABBABAB'
        >>> apply_pipeline('bbabb') == 'BBABB'
        >>> apply_pipeline('babbab') == 'BABBAB'
        >>> apply_pipeline('aaababaa') == 'AAAAABAA'
        >>> apply_pipeline('aaababba') == 'AAAAABBA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('ababaabab') == 'ABABAAAAB'
        >>> apply_pipeline('a') == 'A'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.replace('bbbb', 'ba')
    s = s.replace('aab', 'aaa')
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbabbabab') == 'ABBABBABAB'
    assert candidate('bbabb') == 'BBABB'
    assert candidate('babbab') == 'BABBAB'
    assert candidate('aaababaa') == 'AAAAABAA'
    assert candidate('aaababba') == 'AAAAABBA'
    assert candidate('a') == 'A'
    assert candidate('ababaabab') == 'ABABAAAAB'
    assert candidate('a') == 'A'

    # hidden tests
    assert candidate('aaaa') == 'AAAA'
    assert candidate('baba') == 'BABA'
    assert candidate('babbabb') == 'BABBABB'
    assert candidate('baa') == 'BAA'
    assert candidate('bbaabbbba') == 'BBAAAAA'
    assert candidate('baaab') == 'BAAAA'
    assert candidate('ab') == 'AB'
    assert candidate('bbbab') == 'BBBAB'
    assert candidate('b') == 'B'
    assert candidate('baa') == 'BAA'
    assert candidate('baabbba') == 'BAAABBA'
    assert candidate('abb') == 'ABB'
    assert candidate('babbaa') == 'BABBAA'
    assert candidate('ababbaa') == 'ABABBAA'
    assert candidate('abaabaaaba') == 'ABAAAAAAAA'
    assert candidate('babbaba') == 'BABBABA'
    assert candidate('bba') == 'BBA'
    assert candidate('aa') == 'AA'
    assert candidate('aabba') == 'AAABA'
    assert candidate('aaaba') == 'AAAAA'
    assert candidate('bbaaaaa') == 'BBAAAAA'
    assert candidate('babb') == 'BABB'
    assert candidate('bbbaaa') == 'BBBAAA'
    assert candidate('babbaa') == 'BABBAA'
    assert candidate('ababbaaaa') == 'ABABBAAAA'
    assert candidate('bbaababaab') == 'BBAAAABAAA'
    assert candidate('abbabaaaba') == 'ABBABAAAAA'
    assert candidate('aabaaaaaba') == 'AAAAAAAAAA'
    assert candidate('babbba') == 'BABBBA'
    assert candidate('b') == 'B'
    assert candidate('bba') == 'BBA'
    assert candidate('bbabaabb') == 'BBABAAAB'

Input: abbabbabab

Output: ABBABBABAB

Input: bbabb

Output: BBABB

Input: babbab

Output: BABBAB

Input: aaababaa

Output: AAAAABAA

Input: aaababba

Output: AAAAABBA

Input: a

Output: A

Input: ababaabab

Output: ABABAAAAB

Input: a

Output: A

Input: aaaa

Output: AAAA

Input: baba

Output: BABA

Input: babbabb

Output: BABBABB

Input: baa

Output: BAA

Input: bbaabbbba

Output: BBAAAAA

Input: baaab

Output: BAAAA

Input: ab

Output: AB

Input: bbbab

Output: BBBAB

Input: b

Output: B

Input: baa

Output: BAA

Input: baabbba

Output: BAAABBA

Input: abb

Output: ABB

Input: babbaa

Output: BABBAA

Input: ababbaa

Output: ABABBAA

Input: abaabaaaba

Output: ABAAAAAAAA

Input: babbaba

Output: BABBABA

Input: bba

Output: BBA

Input: aa

Output: AA

Input: aabba

Output: AAABA

Input: aaaba

Output: AAAAA

Input: bbaaaaa

Output: BBAAAAA

Input: babb

Output: BABB

Input: bbbaaa

Output: BBBAAA

Input: babbaa

Output: BABBAA

Input: ababbaaaa

Output: ABABBAAAA

Input: bbaababaab

Output: BBAAAABAAA

Input: abbabaaaba

Output: ABBABAAAAA

Input: aabaaaaaba

Output: AAAAAAAAAA

Input: babbba

Output: BABBBA

Input: b

Output: B

Input: bba

Output: BBA

Input: bbabaabb

Output: BBABAAAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('abbbbba') == 'ABBBBBA'
        >>> apply_pipeline('aba') == 'ABA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bbbaaabaa') == 'BBBAAABAA'
        >>> apply_pipeline('aabbbaa') == 'AABBBAA'
        >>> apply_pipeline('abaabbaab') == 'ABAABBAAB'
        >>> apply_pipeline('aab') == 'AAB'
        >>> apply_pipeline('bbbbb') == 'BBBBB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.lower()
    s = s.replace('abbb', 'abbb')
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbbbba') == 'ABBBBBA'
    assert candidate('aba') == 'ABA'
    assert candidate('b') == 'B'
    assert candidate('bbbaaabaa') == 'BBBAAABAA'
    assert candidate('aabbbaa') == 'AABBBAA'
    assert candidate('abaabbaab') == 'ABAABBAAB'
    assert candidate('aab') == 'AAB'
    assert candidate('bbbbb') == 'BBBBB'

    # hidden tests
    assert candidate('aab') == 'AAB'
    assert candidate('b') == 'B'
    assert candidate('abaaba') == 'ABAABA'
    assert candidate('aaabaaa') == 'AAABAAA'
    assert candidate('baaaa') == 'BAAAA'
    assert candidate('abbabbbbb') == 'ABBABBBBB'
    assert candidate('babaa') == 'BABAA'
    assert candidate('ba') == 'BA'
    assert candidate('bb') == 'BB'
    assert candidate('bbaaab') == 'BBAAAB'
    assert candidate('ba') == 'BA'
    assert candidate('baabaa') == 'BAABAA'
    assert candidate('bbb') == 'BBB'
    assert candidate('ababbbab') == 'ABABBBAB'
    assert candidate('aaaabaaaa') == 'AAAABAAAA'
    assert candidate('b') == 'B'
    assert candidate('bb') == 'BB'
    assert candidate('aaabaa') == 'AAABAA'
    assert candidate('aaabbba') == 'AAABBBA'
    assert candidate('b') == 'B'
    assert candidate('aababbbbab') == 'AABABBBBAB'
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('bba') == 'BBA'
    assert candidate('baababbb') == 'BAABABBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aababbb') == 'AABABBB'
    assert candidate('ab') == 'AB'
    assert candidate('aabbaa') == 'AABBAA'
    assert candidate('aabbbabbbb') == 'AABBBABBBB'
    assert candidate('baa') == 'BAA'
    assert candidate('bb') == 'BB'
    assert candidate('babb') == 'BABB'

Input: abbbbba

Output: ABBBBBA

Input: aba

Output: ABA

Input: b

Output: B

Input: bbbaaabaa

Output: BBBAAABAA

Input: aabbbaa

Output: AABBBAA

Input: abaabbaab

Output: ABAABBAAB

Input: aab

Output: AAB

Input: bbbbb

Output: BBBBB

Input: aab

Output: AAB

Input: b

Output: B

Input: abaaba

Output: ABAABA

Input: aaabaaa

Output: AAABAAA

Input: baaaa

Output: BAAAA

Input: abbabbbbb

Output: ABBABBBBB

Input: babaa

Output: BABAA

Input: ba

Output: BA

Input: bb

Output: BB

Input: bbaaab

Output: BBAAAB

Input: ba

Output: BA

Input: baabaa

Output: BAABAA

Input: bbb

Output: BBB

Input: ababbbab

Output: ABABBBAB

Input: aaaabaaaa

Output: AAAABAAAA

Input: b

Output: B

Input: bb

Output: BB

Input: aaabaa

Output: AAABAA

Input: aaabbba

Output: AAABBBA

Input: b

Output: B

Input: aababbbbab

Output: AABABBBBAB

Input: aaabbaa

Output: AAABBAA

Input: bba

Output: BBA

Input: baababbb

Output: BAABABBB

Input: aaa

Output: AAA

Input: aababbb

Output: AABABBB

Input: ab

Output: AB

Input: aabbaa

Output: AABBAA

Input: aabbbabbbb

Output: AABBBABBBB

Input: baa

Output: BAA

Input: bb

Output: BB

Input: babb

Output: BABB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aab') == 'AAB'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('aababaab') == 'AAabaAAB'
        >>> apply_pipeline('ababababba') == 'AabaAabaBA'
        >>> apply_pipeline('babbbab') == 'abaBaba'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('aaaabbab') == 'AAAABaba'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    s = s.upper()
    s = s.replace('BAB', 'aba')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'B'
    assert candidate('aab') == 'AAB'
    assert candidate('aa') == 'AA'
    assert candidate('aababaab') == 'AAabaAAB'
    assert candidate('ababababba') == 'AabaAabaBA'
    assert candidate('babbbab') == 'abaBaba'
    assert candidate('a') == 'A'
    assert candidate('aaaabbab') == 'AAAABaba'

    # hidden tests
    assert candidate('aabab') == 'AAaba'
    assert candidate('ba') == 'BA'
    assert candidate('babaab') == 'abaAAB'
    assert candidate('a') == 'A'
    assert candidate('bbbabbaba') == 'BBabaabaA'
    assert candidate('babababba') == 'abaAabaBA'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('bbb') == 'BBB'
    assert candidate('aa') == 'AA'
    assert candidate('babbb') == 'abaBB'
    assert candidate('bbaabbbaa') == 'BBAABBBAA'
    assert candidate('babb') == 'abaB'
    assert candidate('abbba') == 'ABBBA'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('bbba') == 'BBBA'
    assert candidate('abaabbbb') == 'ABAABBBB'
    assert candidate('bbababab') == 'BabaAaba'
    assert candidate('babbbbbb') == 'abaBBBBB'
    assert candidate('abbab') == 'ABaba'
    assert candidate('bbba') == 'BBBA'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('bbabaabbb') == 'BabaAABBB'
    assert candidate('abbbab') == 'ABBaba'
    assert candidate('ab') == 'AB'
    assert candidate('aaaaaaba') == 'AAAAAABA'
    assert candidate('bbbaabb') == 'BBBAABB'
    assert candidate('abbbab') == 'ABBaba'
    assert candidate('aab') == 'AAB'
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('aa') == 'AA'
    assert candidate('bbaab') == 'BBAAB'

Input: b

Output: B

Input: aab

Output: AAB

Input: aa

Output: AA

Input: aababaab

Output: AAabaAAB

Input: ababababba

Output: AabaAabaBA

Input: babbbab

Output: abaBaba

Input: a

Output: A

Input: aaaabbab

Output: AAAABaba

Input: aabab

Output: AAaba

Input: ba

Output: BA

Input: babaab

Output: abaAAB

Input: a

Output: A

Input: bbbabbaba

Output: BBabaabaA

Input: babababba

Output: abaAabaBA

Input: a

Output: A

Input: a

Output: A

Input: bbb

Output: BBB

Input: aa

Output: AA

Input: babbb

Output: abaBB

Input: bbaabbbaa

Output: BBAABBBAA

Input: babb

Output: abaB

Input: abbba

Output: ABBBA

Input: aaaa

Output: AAAA

Input: bbba

Output: BBBA

Input: abaabbbb

Output: ABAABBBB

Input: bbababab

Output: BabaAaba

Input: babbbbbb

Output: abaBBBBB

Input: abbab

Output: ABaba

Input: bbba

Output: BBBA

Input: bbbb

Output: BBBB

Input: bbabaabbb

Output: BabaAABBB

Input: abbbab

Output: ABBaba

Input: ab

Output: AB

Input: aaaaaaba

Output: AAAAAABA

Input: bbbaabb

Output: BBBAABB

Input: abbbab

Output: ABBaba

Input: aab

Output: AAB

Input: aaabbaa

Output: AAABBAA

Input: aa

Output: AA

Input: bbaab

Output: BBAAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('babaa') == 'babaa'
        >>> apply_pipeline('bba') == 'bba'
        >>> apply_pipeline('aabba') == 'aabba'
        >>> apply_pipeline('bbbbbb') == 'aaaaaa'
        >>> apply_pipeline('abaabbaa') == 'abaabbaa'
        >>> apply_pipeline('bbabbbab') == 'bbaaaaab'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('baabbbabaa') == 'baaaaaabaa'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('bbb', 'aaa')
    s = s.lower()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babaa') == 'babaa'
    assert candidate('bba') == 'bba'
    assert candidate('aabba') == 'aabba'
    assert candidate('bbbbbb') == 'aaaaaa'
    assert candidate('abaabbaa') == 'abaabbaa'
    assert candidate('bbabbbab') == 'bbaaaaab'
    assert candidate('b') == 'b'
    assert candidate('baabbbabaa') == 'baaaaaabaa'

    # hidden tests
    assert candidate('aba') == 'aba'
    assert candidate('aaabbba') == 'aaaaaaa'
    assert candidate('baaabba') == 'baaabba'
    assert candidate('a') == 'a'
    assert candidate('aabbaa') == 'aabbaa'
    assert candidate('baaaaaabb') == 'baaaaaabb'
    assert candidate('bbababaab') == 'bbababaab'
    assert candidate('bb') == 'bb'
    assert candidate('aba') == 'aba'
    assert candidate('bab') == 'bab'
    assert candidate('b') == 'b'
    assert candidate('aaababbbb') == 'aaabaaaab'
    assert candidate('bbbaa') == 'aaaaa'
    assert candidate('abbbb') == 'aaaab'
    assert candidate('aabb') == 'aabb'
    assert candidate('baabbb') == 'baaaaa'
    assert candidate('baaaba') == 'baaaba'
    assert candidate('aaaaaab') == 'aaaaaab'
    assert candidate('b') == 'b'
    assert candidate('bbaaaaab') == 'bbaaaaab'
    assert candidate('bb') == 'bb'
    assert candidate('abba') == 'abba'
    assert candidate('abbababbaa') == 'abbababbaa'
    assert candidate('babbaabaab') == 'babbaabaab'
    assert candidate('abbbbbaa') == 'aaaabbaa'
    assert candidate('aaaaaa') == 'aaaaaa'
    assert candidate('aba') == 'aba'
    assert candidate('b') == 'b'
    assert candidate('bbbbbbbab') == 'aaaaaabab'
    assert candidate('babbb') == 'baaaa'
    assert candidate('bbbaaabaab') == 'aaaaaabaab'
    assert candidate('bbabbb') == 'bbaaaa'

Input: babaa

Output: babaa

Input: bba

Output: bba

Input: aabba

Output: aabba

Input: bbbbbb

Output: aaaaaa

Input: abaabbaa

Output: abaabbaa

Input: bbabbbab

Output: bbaaaaab

Input: b

Output: b

Input: baabbbabaa

Output: baaaaaabaa

Input: aba

Output: aba

Input: aaabbba

Output: aaaaaaa

Input: baaabba

Output: baaabba

Input: a

Output: a

Input: aabbaa

Output: aabbaa

Input: baaaaaabb

Output: baaaaaabb

Input: bbababaab

Output: bbababaab

Input: bb

Output: bb

Input: aba

Output: aba

Input: bab

Output: bab

Input: b

Output: b

Input: aaababbbb

Output: aaabaaaab

Input: bbbaa

Output: aaaaa

Input: abbbb

Output: aaaab

Input: aabb

Output: aabb

Input: baabbb

Output: baaaaa

Input: baaaba

Output: baaaba

Input: aaaaaab

Output: aaaaaab

Input: b

Output: b

Input: bbaaaaab

Output: bbaaaaab

Input: bb

Output: bb

Input: abba

Output: abba

Input: abbababbaa

Output: abbababbaa

Input: babbaabaab

Output: babbaabaab

Input: abbbbbaa

Output: aaaabbaa

Input: aaaaaa

Output: aaaaaa

Input: aba

Output: aba

Input: b

Output: b

Input: bbbbbbbab

Output: aaaaaabab

Input: babbb

Output: baaaa

Input: bbbaaabaab

Output: aaaaaabaab

Input: bbabbb

Output: bbaaaa


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aabba') == 'AABBA'
        >>> apply_pipeline('ababbbbaba') == 'ABABBBBABA'
        >>> apply_pipeline('aabbab') == 'AABBAB'
        >>> apply_pipeline('abbbbabb') == 'ABBBBABB'
        >>> apply_pipeline('aaab') == 'AAAB'
        >>> apply_pipeline('aba') == 'ABA'
        >>> apply_pipeline('bbaabbb') == 'BBAABBB'
        >>> apply_pipeline('abbbba') == 'ABBBBA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aabba') == 'AABBA'
    assert candidate('ababbbbaba') == 'ABABBBBABA'
    assert candidate('aabbab') == 'AABBAB'
    assert candidate('abbbbabb') == 'ABBBBABB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('aba') == 'ABA'
    assert candidate('bbaabbb') == 'BBAABBB'
    assert candidate('abbbba') == 'ABBBBA'

    # hidden tests
    assert candidate('abbbbbabb') == 'ABBBBBABB'
    assert candidate('a') == 'A'
    assert candidate('baabaaabb') == 'BAABAAABB'
    assert candidate('b') == 'B'
    assert candidate('b') == 'B'
    assert candidate('bb') == 'BB'
    assert candidate('babbbababb') == 'BABBBABABB'
    assert candidate('baabbbbaab') == 'BAABBBBAAB'
    assert candidate('a') == 'A'
    assert candidate('baaabbaaab') == 'BAAABBAAAB'
    assert candidate('b') == 'B'
    assert candidate('babbabba') == 'BABBABBA'
    assert candidate('aababbb') == 'AABABBB'
    assert candidate('babb') == 'BABB'
    assert candidate('bbba') == 'BBBA'
    assert candidate('abaaabaa') == 'ABAAABAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('ba') == 'BA'
    assert candidate('b') == 'B'
    assert candidate('abbab') == 'ABBAB'
    assert candidate('abbbbab') == 'ABBBBAB'
    assert candidate('aaaababbb') == 'AAAABABBB'
    assert candidate('abaababab') == 'ABAABABAB'
    assert candidate('baabbaaaaa') == 'BAABBAAAAA'
    assert candidate('aba') == 'ABA'
    assert candidate('abaaba') == 'ABAABA'
    assert candidate('bbbbbb') == 'BBBBBB'
    assert candidate('baabbbb') == 'BAABBBB'
    assert candidate('aa') == 'AA'
    assert candidate('baabbaaba') == 'BAABBAABA'
    assert candidate('a') == 'A'
    assert candidate('aabbbabba') == 'AABBBABBA'

Input: aabba

Output: AABBA

Input: ababbbbaba

Output: ABABBBBABA

Input: aabbab

Output: AABBAB

Input: abbbbabb

Output: ABBBBABB

Input: aaab

Output: AAAB

Input: aba

Output: ABA

Input: bbaabbb

Output: BBAABBB

Input: abbbba

Output: ABBBBA

Input: abbbbbabb

Output: ABBBBBABB

Input: a

Output: A

Input: baabaaabb

Output: BAABAAABB

Input: b

Output: B

Input: b

Output: B

Input: bb

Output: BB

Input: babbbababb

Output: BABBBABABB

Input: baabbbbaab

Output: BAABBBBAAB

Input: a

Output: A

Input: baaabbaaab

Output: BAAABBAAAB

Input: b

Output: B

Input: babbabba

Output: BABBABBA

Input: aababbb

Output: AABABBB

Input: babb

Output: BABB

Input: bbba

Output: BBBA

Input: abaaabaa

Output: ABAAABAA

Input: baaa

Output: BAAA

Input: ba

Output: BA

Input: b

Output: B

Input: abbab

Output: ABBAB

Input: abbbbab

Output: ABBBBAB

Input: aaaababbb

Output: AAAABABBB

Input: abaababab

Output: ABAABABAB

Input: baabbaaaaa

Output: BAABBAAAAA

Input: aba

Output: ABA

Input: abaaba

Output: ABAABA

Input: bbbbbb

Output: BBBBBB

Input: baabbbb

Output: BAABBBB

Input: aa

Output: AA

Input: baabbaaba

Output: BAABBAABA

Input: a

Output: A

Input: aabbbabba

Output: AABBBABBA


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('ababbab') == 'ababbab'
        >>> apply_pipeline('baaaa') == 'baaaa'
        >>> apply_pipeline('aabab') == 'aabab'
        >>> apply_pipeline('abba') == 'abba'
        >>> apply_pipeline('baabababaa') == 'bbaaababaa'
        >>> apply_pipeline('abbb') == 'abbb'
        >>> apply_pipeline('abbb') == 'abbb'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('baab', 'bbaa')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('a') == 'a'
    assert candidate('ababbab') == 'ababbab'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('aabab') == 'aabab'
    assert candidate('abba') == 'abba'
    assert candidate('baabababaa') == 'bbaaababaa'
    assert candidate('abbb') == 'abbb'
    assert candidate('abbb') == 'abbb'

    # hidden tests
    assert candidate('babba') == 'babba'
    assert candidate('ab') == 'ab'
    assert candidate('abbabab') == 'abbabab'
    assert candidate('bbbbaaaabb') == 'bbbbaaaabb'
    assert candidate('bbbbbbb') == 'bbbbbbb'
    assert candidate('abaababb') == 'abbaaabb'
    assert candidate('aaabb') == 'aaabb'
    assert candidate('bbabbabaa') == 'bbabbabaa'
    assert candidate('abbabbbbb') == 'abbabbbbb'
    assert candidate('aabababb') == 'aabababb'
    assert candidate('abaaababaa') == 'abaaababaa'
    assert candidate('baaababaa') == 'baaababaa'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('abbb') == 'abbb'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('baabbaabbb') == 'bbaabbaabb'
    assert candidate('abaaba') == 'abbaaa'
    assert candidate('aabbbbbb') == 'aabbbbbb'
    assert candidate('aaaaba') == 'aaaaba'
    assert candidate('bbaaba') == 'bbbaaa'
    assert candidate('bbabbabb') == 'bbabbabb'
    assert candidate('bbaaaaaaa') == 'bbaaaaaaa'
    assert candidate('abaa') == 'abaa'
    assert candidate('bbbaabbaba') == 'bbbbaababa'
    assert candidate('ba') == 'ba'
    assert candidate('bbaab') == 'bbbaa'
    assert candidate('bbbabaaaaa') == 'bbbabaaaaa'
    assert candidate('aabaaabb') == 'aabaaabb'
    assert candidate('aaaaaa') == 'aaaaaa'
    assert candidate('bb') == 'bb'
    assert candidate('bbabb') == 'bbabb'

Input: a

Output: a

Input: ababbab

Output: ababbab

Input: baaaa

Output: baaaa

Input: aabab

Output: aabab

Input: abba

Output: abba

Input: baabababaa

Output: bbaaababaa

Input: abbb

Output: abbb

Input: abbb

Output: abbb

Input: babba

Output: babba

Input: ab

Output: ab

Input: abbabab

Output: abbabab

Input: bbbbaaaabb

Output: bbbbaaaabb

Input: bbbbbbb

Output: bbbbbbb

Input: abaababb

Output: abbaaabb

Input: aaabb

Output: aaabb

Input: bbabbabaa

Output: bbabbabaa

Input: abbabbbbb

Output: abbabbbbb

Input: aabababb

Output: aabababb

Input: abaaababaa

Output: abaaababaa

Input: baaababaa

Output: baaababaa

Input: aaaa

Output: aaaa

Input: abbb

Output: abbb

Input: b

Output: b

Input: b

Output: b

Input: baabbaabbb

Output: bbaabbaabb

Input: abaaba

Output: abbaaa

Input: aabbbbbb

Output: aabbbbbb

Input: aaaaba

Output: aaaaba

Input: bbaaba

Output: bbbaaa

Input: bbabbabb

Output: bbabbabb

Input: bbaaaaaaa

Output: bbaaaaaaa

Input: abaa

Output: abaa

Input: bbbaabbaba

Output: bbbbaababa

Input: ba

Output: ba

Input: bbaab

Output: bbbaa

Input: bbbabaaaaa

Output: bbbabaaaaa

Input: aabaaabb

Output: aabaaabb

Input: aaaaaa

Output: aaaaaa

Input: bb

Output: bb

Input: bbabb

Output: bbabb


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('ababb') == 'ABABB'
        >>> apply_pipeline('ababaabbb') == 'ABABAABBB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aaabaab') == 'AAABAAB'
        >>> apply_pipeline('aababb') == 'AABABB'
        >>> apply_pipeline('aaaaa') == 'AAAAA'
        >>> apply_pipeline('aabbb') == 'AABBB'
        >>> apply_pipeline('bba') == 'BBA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('ababb') == 'ABABB'
    assert candidate('ababaabbb') == 'ABABAABBB'
    assert candidate('b') == 'B'
    assert candidate('aaabaab') == 'AAABAAB'
    assert candidate('aababb') == 'AABABB'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('aabbb') == 'AABBB'
    assert candidate('bba') == 'BBA'

    # hidden tests
    assert candidate('bbabaaa') == 'BBABAAA'
    assert candidate('bab') == 'BAB'
    assert candidate('abbaaaaa') == 'ABBAAAAA'
    assert candidate('aabbbbabba') == 'AABBBBABBA'
    assert candidate('babbbaba') == 'BABBBABA'
    assert candidate('abba') == 'ABBA'
    assert candidate('b') == 'B'
    assert candidate('bbaababa') == 'BBAABABA'
    assert candidate('baaba') == 'BAABA'
    assert candidate('babbaaaaa') == 'BABBAAAAA'
    assert candidate('b') == 'B'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('a') == 'A'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('bbb') == 'BBB'
    assert candidate('b') == 'B'
    assert candidate('baaa') == 'BAAA'
    assert candidate('baba') == 'BABA'
    assert candidate('aaaabaa') == 'AAAABAA'
    assert candidate('abbbbaba') == 'ABBBBABA'
    assert candidate('aabbb') == 'AABBB'
    assert candidate('aaabb') == 'AAABB'
    assert candidate('ab') == 'AB'
    assert candidate('abaa') == 'ABAA'
    assert candidate('baba') == 'BABA'
    assert candidate('babab') == 'BABAB'
    assert candidate('bbbabbaa') == 'BBBABBAA'
    assert candidate('abbaababa') == 'ABBAABABA'
    assert candidate('bb') == 'BB'
    assert candidate('baaa') == 'BAAA'
    assert candidate('bababaab') == 'BABABAAB'
    assert candidate('bbbbbabaab') == 'BBBBBABAAB'

Input: ababb

Output: ABABB

Input: ababaabbb

Output: ABABAABBB

Input: b

Output: B

Input: aaabaab

Output: AAABAAB

Input: aababb

Output: AABABB

Input: aaaaa

Output: AAAAA

Input: aabbb

Output: AABBB

Input: bba

Output: BBA

Input: bbabaaa

Output: BBABAAA

Input: bab

Output: BAB

Input: abbaaaaa

Output: ABBAAAAA

Input: aabbbbabba

Output: AABBBBABBA

Input: babbbaba

Output: BABBBABA

Input: abba

Output: ABBA

Input: b

Output: B

Input: bbaababa

Output: BBAABABA

Input: baaba

Output: BAABA

Input: babbaaaaa

Output: BABBAAAAA

Input: b

Output: B

Input: bbaa

Output: BBAA

Input: a

Output: A

Input: bbaa

Output: BBAA

Input: bbb

Output: BBB

Input: b

Output: B

Input: baaa

Output: BAAA

Input: baba

Output: BABA

Input: aaaabaa

Output: AAAABAA

Input: abbbbaba

Output: ABBBBABA

Input: aabbb

Output: AABBB

Input: aaabb

Output: AAABB

Input: ab

Output: AB

Input: abaa

Output: ABAA

Input: baba

Output: BABA

Input: babab

Output: BABAB

Input: bbbabbaa

Output: BBBABBAA

Input: abbaababa

Output: ABBAABABA

Input: bb

Output: BB

Input: baaa

Output: BAAA

Input: bababaab

Output: BABABAAB

Input: bbbbbabaab

Output: BBBBBABAAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('baa') == 'BAA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('abaaa') == 'ABAAA'
        >>> apply_pipeline('bbbaba') == 'BBBABA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('babbba') == 'BABBBA'
        >>> apply_pipeline('aaaabbbbaa') == 'AAAABBBBAA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baa') == 'BAA'
    assert candidate('b') == 'B'
    assert candidate('a') == 'A'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('bbbaba') == 'BBBABA'
    assert candidate('b') == 'B'
    assert candidate('babbba') == 'BABBBA'
    assert candidate('aaaabbbbaa') == 'AAAABBBBAA'

    # hidden tests
    assert candidate('aab') == 'AAB'
    assert candidate('bbbababab') == 'BBBABABAB'
    assert candidate('bbb') == 'BBB'
    assert candidate('bbbaaaaba') == 'BBBAAAABA'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('babb') == 'BABB'
    assert candidate('a') == 'A'
    assert candidate('aa') == 'AA'
    assert candidate('bba') == 'BBA'
    assert candidate('aabab') == 'AABAB'
    assert candidate('ab') == 'AB'
    assert candidate('aaaabbab') == 'AAAABBAB'
    assert candidate('babaaaba') == 'BABAAABA'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('ababaaaba') == 'ABABAAABA'
    assert candidate('abbbabba') == 'ABBBABBA'
    assert candidate('babbabbaaa') == 'BABBABBAAA'
    assert candidate('abbb') == 'ABBB'
    assert candidate('bbaab') == 'BBAAB'
    assert candidate('bbabba') == 'BBABBA'
    assert candidate('abbb') == 'ABBB'
    assert candidate('baaaaabbaa') == 'BAAAAABBAA'
    assert candidate('baabaaa') == 'BAABAAA'
    assert candidate('bbaaabb') == 'BBAAABB'
    assert candidate('aaaaabb') == 'AAAAABB'
    assert candidate('baaba') == 'BAABA'
    assert candidate('abbaabb') == 'ABBAABB'
    assert candidate('bbbbb') == 'BBBBB'
    assert candidate('babaabaaa') == 'BABAABAAA'
    assert candidate('baabbabb') == 'BAABBABB'
    assert candidate('baaabaaaba') == 'BAAABAAABA'
    assert candidate('baabaaabbb') == 'BAABAAABBB'

Input: baa

Output: BAA

Input: b

Output: B

Input: a

Output: A

Input: abaaa

Output: ABAAA

Input: bbbaba

Output: BBBABA

Input: b

Output: B

Input: babbba

Output: BABBBA

Input: aaaabbbbaa

Output: AAAABBBBAA

Input: aab

Output: AAB

Input: bbbababab

Output: BBBABABAB

Input: bbb

Output: BBB

Input: bbbaaaaba

Output: BBBAAAABA

Input: baaab

Output: BAAAB

Input: babb

Output: BABB

Input: a

Output: A

Input: aa

Output: AA

Input: bba

Output: BBA

Input: aabab

Output: AABAB

Input: ab

Output: AB

Input: aaaabbab

Output: AAAABBAB

Input: babaaaba

Output: BABAAABA

Input: aaaaa

Output: AAAAA

Input: ababaaaba

Output: ABABAAABA

Input: abbbabba

Output: ABBBABBA

Input: babbabbaaa

Output: BABBABBAAA

Input: abbb

Output: ABBB

Input: bbaab

Output: BBAAB

Input: bbabba

Output: BBABBA

Input: abbb

Output: ABBB

Input: baaaaabbaa

Output: BAAAAABBAA

Input: baabaaa

Output: BAABAAA

Input: bbaaabb

Output: BBAAABB

Input: aaaaabb

Output: AAAAABB

Input: baaba

Output: BAABA

Input: abbaabb

Output: ABBAABB

Input: bbbbb

Output: BBBBB

Input: babaabaaa

Output: BABAABAAA

Input: baabbabb

Output: BAABBABB

Input: baaabaaaba

Output: BAAABAAABA

Input: baabaaabbb

Output: BAABAAABBB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('babaa') == 'babaa'
        >>> apply_pipeline('abbba') == 'abbba'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('baababb') == 'baababb'
        >>> apply_pipeline('aaaaaaaabb') == 'aaaaaaaabb'
        >>> apply_pipeline('abbaa') == 'abbaa'
        >>> apply_pipeline('baaa') == 'baaa'
        >>> apply_pipeline('ba') == 'ba'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('bbbb', 'aaaba')
    s = s.lower()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babaa') == 'babaa'
    assert candidate('abbba') == 'abbba'
    assert candidate('a') == 'a'
    assert candidate('baababb') == 'baababb'
    assert candidate('aaaaaaaabb') == 'aaaaaaaabb'
    assert candidate('abbaa') == 'abbaa'
    assert candidate('baaa') == 'baaa'
    assert candidate('ba') == 'ba'

    # hidden tests
    assert candidate('abb') == 'abb'
    assert candidate('baab') == 'baab'
    assert candidate('bba') == 'bba'
    assert candidate('aabb') == 'aabb'
    assert candidate('aa') == 'aa'
    assert candidate('bbbbababbb') == 'aaabaababbb'
    assert candidate('aabbba') == 'aabbba'
    assert candidate('ab') == 'ab'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('babbbbaaa') == 'baaaabaaaa'
    assert candidate('baaaaa') == 'baaaaa'
    assert candidate('abbaaaaba') == 'abbaaaaba'
    assert candidate('baaaabaaa') == 'baaaabaaa'
    assert candidate('abbbbaaa') == 'aaaabaaaa'
    assert candidate('aaababab') == 'aaababab'
    assert candidate('ababb') == 'ababb'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('bbbaaabaaa') == 'bbbaaabaaa'
    assert candidate('bbaabaaaaa') == 'bbaabaaaaa'
    assert candidate('abaaaba') == 'abaaaba'
    assert candidate('aaa') == 'aaa'
    assert candidate('ababb') == 'ababb'
    assert candidate('abaa') == 'abaa'
    assert candidate('abbaabbbbb') == 'abbaaaaabab'
    assert candidate('a') == 'a'
    assert candidate('abbb') == 'abbb'
    assert candidate('aabab') == 'aabab'
    assert candidate('bbaabbb') == 'bbaabbb'
    assert candidate('aababbbab') == 'aababbbab'
    assert candidate('aab') == 'aab'
    assert candidate('ab') == 'ab'
    assert candidate('b') == 'b'

Input: babaa

Output: babaa

Input: abbba

Output: abbba

Input: a

Output: a

Input: baababb

Output: baababb

Input: aaaaaaaabb

Output: aaaaaaaabb

Input: abbaa

Output: abbaa

Input: baaa

Output: baaa

Input: ba

Output: ba

Input: abb

Output: abb

Input: baab

Output: baab

Input: bba

Output: bba

Input: aabb

Output: aabb

Input: aa

Output: aa

Input: bbbbababbb

Output: aaabaababbb

Input: aabbba

Output: aabbba

Input: ab

Output: ab

Input: bbaa

Output: bbaa

Input: babbbbaaa

Output: baaaabaaaa

Input: baaaaa

Output: baaaaa

Input: abbaaaaba

Output: abbaaaaba

Input: baaaabaaa

Output: baaaabaaa

Input: abbbbaaa

Output: aaaabaaaa

Input: aaababab

Output: aaababab

Input: ababb

Output: ababb

Input: bbaa

Output: bbaa

Input: bbbaaabaaa

Output: bbbaaabaaa

Input: bbaabaaaaa

Output: bbaabaaaaa

Input: abaaaba

Output: abaaaba

Input: aaa

Output: aaa

Input: ababb

Output: ababb

Input: abaa

Output: abaa

Input: abbaabbbbb

Output: abbaaaaabab

Input: a

Output: a

Input: abbb

Output: abbb

Input: aabab

Output: aabab

Input: bbaabbb

Output: bbaabbb

Input: aababbbab

Output: aababbbab

Input: aab

Output: aab

Input: ab

Output: ab

Input: b

Output: b


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aaabbaa') == 'AAABBAA'
        >>> apply_pipeline('bbaba') == 'BBABA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bababaaa') == 'BABABAAA'
        >>> apply_pipeline('baaababbaa') == 'BAAABABBAA'
        >>> apply_pipeline('baaabbb') == 'BAAABBB'
        >>> apply_pipeline('bbaabb') == 'BBAABB'
        >>> apply_pipeline('ba') == 'BA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('bbaba') == 'BBABA'
    assert candidate('b') == 'B'
    assert candidate('bababaaa') == 'BABABAAA'
    assert candidate('baaababbaa') == 'BAAABABBAA'
    assert candidate('baaabbb') == 'BAAABBB'
    assert candidate('bbaabb') == 'BBAABB'
    assert candidate('ba') == 'BA'

    # hidden tests
    assert candidate('baa') == 'BAA'
    assert candidate('aabb') == 'AABB'
    assert candidate('abab') == 'ABAB'
    assert candidate('abbaba') == 'ABBABA'
    assert candidate('aaab') == 'AAAB'
    assert candidate('babbbaab') == 'BABBBAAB'
    assert candidate('bbbaaa') == 'BBBAAA'
    assert candidate('b') == 'B'
    assert candidate('bb') == 'BB'
    assert candidate('ab') == 'AB'
    assert candidate('bbbbb') == 'BBBBB'
    assert candidate('aa') == 'AA'
    assert candidate('aaababbab') == 'AAABABBAB'
    assert candidate('aaaaaab') == 'AAAAAAB'
    assert candidate('bbbbaab') == 'BBBBAAB'
    assert candidate('bbbbaa') == 'BBBBAA'
    assert candidate('abbabbb') == 'ABBABBB'
    assert candidate('baaabbaab') == 'BAAABBAAB'
    assert candidate('aaaabba') == 'AAAABBA'
    assert candidate('aaaaabb') == 'AAAAABB'
    assert candidate('ababab') == 'ABABAB'
    assert candidate('aabaaaaa') == 'AABAAAAA'
    assert candidate('abbabbbaab') == 'ABBABBBAAB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aaba') == 'AABA'
    assert candidate('ab') == 'AB'
    assert candidate('abaa') == 'ABAA'
    assert candidate('baa') == 'BAA'
    assert candidate('aaabbbaba') == 'AAABBBABA'
    assert candidate('bbbbaa') == 'BBBBAA'
    assert candidate('b') == 'B'
    assert candidate('aaaa') == 'AAAA'

Input: aaabbaa

Output: AAABBAA

Input: bbaba

Output: BBABA

Input: b

Output: B

Input: bababaaa

Output: BABABAAA

Input: baaababbaa

Output: BAAABABBAA

Input: baaabbb

Output: BAAABBB

Input: bbaabb

Output: BBAABB

Input: ba

Output: BA

Input: baa

Output: BAA

Input: aabb

Output: AABB

Input: abab

Output: ABAB

Input: abbaba

Output: ABBABA

Input: aaab

Output: AAAB

Input: babbbaab

Output: BABBBAAB

Input: bbbaaa

Output: BBBAAA

Input: b

Output: B

Input: bb

Output: BB

Input: ab

Output: AB

Input: bbbbb

Output: BBBBB

Input: aa

Output: AA

Input: aaababbab

Output: AAABABBAB

Input: aaaaaab

Output: AAAAAAB

Input: bbbbaab

Output: BBBBAAB

Input: bbbbaa

Output: BBBBAA

Input: abbabbb

Output: ABBABBB

Input: baaabbaab

Output: BAAABBAAB

Input: aaaabba

Output: AAAABBA

Input: aaaaabb

Output: AAAAABB

Input: ababab

Output: ABABAB

Input: aabaaaaa

Output: AABAAAAA

Input: abbabbbaab

Output: ABBABBBAAB

Input: aaa

Output: AAA

Input: aaba

Output: AABA

Input: ab

Output: AB

Input: abaa

Output: ABAA

Input: baa

Output: BAA

Input: aaabbbaba

Output: AAABBBABA

Input: bbbbaa

Output: BBBBAA

Input: b

Output: B

Input: aaaa

Output: AAAA


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('babbab') == 'babbab'
        >>> apply_pipeline('bababbbbb') == 'bababbbbb'
        >>> apply_pipeline('bbbbabab') == 'bbbbabab'
        >>> apply_pipeline('aaababbab') == 'aaababbab'
        >>> apply_pipeline('baaabaab') == 'baaabaab'
        >>> apply_pipeline('bab') == 'bab'
        >>> apply_pipeline('baababbaba') == 'baababbaba'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('bbabb', 'baabb')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'b'
    assert candidate('babbab') == 'babbab'
    assert candidate('bababbbbb') == 'bababbbbb'
    assert candidate('bbbbabab') == 'bbbbabab'
    assert candidate('aaababbab') == 'aaababbab'
    assert candidate('baaabaab') == 'baaabaab'
    assert candidate('bab') == 'bab'
    assert candidate('baababbaba') == 'baababbaba'

    # hidden tests
    assert candidate('b') == 'b'
    assert candidate('baaa') == 'baaa'
    assert candidate('bba') == 'bba'
    assert candidate('baabbb') == 'baabbb'
    assert candidate('abaaabbbb') == 'abaaabbbb'
    assert candidate('bbabaaba') == 'bbabaaba'
    assert candidate('bbaabbab') == 'bbaabbab'
    assert candidate('bba') == 'bba'
    assert candidate('baabb') == 'baabb'
    assert candidate('bbbbbbb') == 'bbbbbbb'
    assert candidate('bbbaabaaa') == 'bbbaabaaa'
    assert candidate('ababbabbaa') == 'ababaabbaa'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('bbbab') == 'bbbab'
    assert candidate('baabbb') == 'baabbb'
    assert candidate('aaa') == 'aaa'
    assert candidate('abbbabaa') == 'abbbabaa'
    assert candidate('aaabbaa') == 'aaabbaa'
    assert candidate('a') == 'a'
    assert candidate('abababbb') == 'abababbb'
    assert candidate('baaaaa') == 'baaaaa'
    assert candidate('abab') == 'abab'
    assert candidate('abbabbbbb') == 'abaabbbbb'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('aba') == 'aba'
    assert candidate('ab') == 'ab'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('bbabaaaaa') == 'bbabaaaaa'
    assert candidate('baa') == 'baa'
    assert candidate('aaab') == 'aaab'
    assert candidate('bbabbba') == 'baabbba'
    assert candidate('bababba') == 'bababba'

Input: b

Output: b

Input: babbab

Output: babbab

Input: bababbbbb

Output: bababbbbb

Input: bbbbabab

Output: bbbbabab

Input: aaababbab

Output: aaababbab

Input: baaabaab

Output: baaabaab

Input: bab

Output: bab

Input: baababbaba

Output: baababbaba

Input: b

Output: b

Input: baaa

Output: baaa

Input: bba

Output: bba

Input: baabbb

Output: baabbb

Input: abaaabbbb

Output: abaaabbbb

Input: bbabaaba

Output: bbabaaba

Input: bbaabbab

Output: bbaabbab

Input: bba

Output: bba

Input: baabb

Output: baabb

Input: bbbbbbb

Output: bbbbbbb

Input: bbbaabaaa

Output: bbbaabaaa

Input: ababbabbaa

Output: ababaabbaa

Input: baaaa

Output: baaaa

Input: bbbab

Output: bbbab

Input: baabbb

Output: baabbb

Input: aaa

Output: aaa

Input: abbbabaa

Output: abbbabaa

Input: aaabbaa

Output: aaabbaa

Input: a

Output: a

Input: abababbb

Output: abababbb

Input: baaaaa

Output: baaaaa

Input: abab

Output: abab

Input: abbabbbbb

Output: abaabbbbb

Input: abbbbaa

Output: abbbbaa

Input: aba

Output: aba

Input: ab

Output: ab

Input: abbbbaa

Output: abbbbaa

Input: bbabaaaaa

Output: bbabaaaaa

Input: baa

Output: baa

Input: aaab

Output: aaab

Input: bbabbba

Output: baabbba

Input: bababba

Output: bababba


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bbbbab') == 'BBBBAB'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('baab') == 'BAAB'
        >>> apply_pipeline('baa') == 'BAA'
        >>> apply_pipeline('aaba') == 'AABA'
        >>> apply_pipeline('abb') == 'ABB'
        >>> apply_pipeline('aaabbaa') == 'AAABBAA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'B'
    assert candidate('bbbbab') == 'BBBBAB'
    assert candidate('aaa') == 'AAA'
    assert candidate('baab') == 'BAAB'
    assert candidate('baa') == 'BAA'
    assert candidate('aaba') == 'AABA'
    assert candidate('abb') == 'ABB'
    assert candidate('aaabbaa') == 'AAABBAA'

    # hidden tests
    assert candidate('bba') == 'BBA'
    assert candidate('aba') == 'ABA'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('ababbbaab') == 'ABABBBAAB'
    assert candidate('baaaabbb') == 'BAAAABBB'
    assert candidate('a') == 'A'
    assert candidate('aaababbba') == 'AAABABBBA'
    assert candidate('abab') == 'ABAB'
    assert candidate('baababa') == 'BAABABA'
    assert candidate('aa') == 'AA'
    assert candidate('a') == 'A'
    assert candidate('aaaaaabbaa') == 'AAAAAABBAA'
    assert candidate('aabbbbaaaa') == 'AABBBBAAAA'
    assert candidate('aaaaabbaab') == 'AAAAABBAAB'
    assert candidate('abb') == 'ABB'
    assert candidate('ababaaaa') == 'ABABAAAA'
    assert candidate('abbabaaaaa') == 'ABBABAAAAA'
    assert candidate('a') == 'A'
    assert candidate('bbbab') == 'BBBAB'
    assert candidate('bb') == 'BB'
    assert candidate('babbbab') == 'BABBBAB'
    assert candidate('aaabaaba') == 'AAABAABA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('baabaa') == 'BAABAA'
    assert candidate('bbaabbb') == 'BBAABBB'
    assert candidate('bbaaaabaab') == 'BBAAAABAAB'
    assert candidate('ba') == 'BA'
    assert candidate('b') == 'B'
    assert candidate('ba') == 'BA'
    assert candidate('baaaabaab') == 'BAAAABAAB'
    assert candidate('bbbaaa') == 'BBBAAA'
    assert candidate('babaabab') == 'BABAABAB'

Input: b

Output: B

Input: bbbbab

Output: BBBBAB

Input: aaa

Output: AAA

Input: baab

Output: BAAB

Input: baa

Output: BAA

Input: aaba

Output: AABA

Input: abb

Output: ABB

Input: aaabbaa

Output: AAABBAA

Input: bba

Output: BBA

Input: aba

Output: ABA

Input: abaaa

Output: ABAAA

Input: ababbbaab

Output: ABABBBAAB

Input: baaaabbb

Output: BAAAABBB

Input: a

Output: A

Input: aaababbba

Output: AAABABBBA

Input: abab

Output: ABAB

Input: baababa

Output: BAABABA

Input: aa

Output: AA

Input: a

Output: A

Input: aaaaaabbaa

Output: AAAAAABBAA

Input: aabbbbaaaa

Output: AABBBBAAAA

Input: aaaaabbaab

Output: AAAAABBAAB

Input: abb

Output: ABB

Input: ababaaaa

Output: ABABAAAA

Input: abbabaaaaa

Output: ABBABAAAAA

Input: a

Output: A

Input: bbbab

Output: BBBAB

Input: bb

Output: BB

Input: babbbab

Output: BABBBAB

Input: aaabaaba

Output: AAABAABA

Input: baaa

Output: BAAA

Input: baabaa

Output: BAABAA

Input: bbaabbb

Output: BBAABBB

Input: bbaaaabaab

Output: BBAAAABAAB

Input: ba

Output: BA

Input: b

Output: B

Input: ba

Output: BA

Input: baaaabaab

Output: BAAAABAAB

Input: bbbaaa

Output: BBBAAA

Input: babaabab

Output: BABAABAB


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aabbaab') == 'aabbaab'
        >>> apply_pipeline('bbbbaaaba') == 'bbbbaaaba'
        >>> apply_pipeline('baaaabb') == 'baaaabb'
        >>> apply_pipeline('aba') == 'aba'
        >>> apply_pipeline('bbbb') == 'bbbb'
        >>> apply_pipeline('bbbbba') == 'bbbbba'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('babbaa') == 'babbaa'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aabbaab') == 'aabbaab'
    assert candidate('bbbbaaaba') == 'bbbbaaaba'
    assert candidate('baaaabb') == 'baaaabb'
    assert candidate('aba') == 'aba'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('bbbbba') == 'bbbbba'
    assert candidate('a') == 'a'
    assert candidate('babbaa') == 'babbaa'

    # hidden tests
    assert candidate('a') == 'a'
    assert candidate('ba') == 'ba'
    assert candidate('aabbbbaa') == 'aabbbbaa'
    assert candidate('b') == 'b'
    assert candidate('bbabaabbaa') == 'bbabaabbaa'
    assert candidate('babb') == 'babb'
    assert candidate('baaaabb') == 'baaaabb'
    assert candidate('bbbaaba') == 'bbbaaba'
    assert candidate('ba') == 'ba'
    assert candidate('baabaabaa') == 'baabaabaa'
    assert candidate('bbbba') == 'bbbba'
    assert candidate('aa') == 'aa'
    assert candidate('bbbabbabaa') == 'bbbabbabaa'
    assert candidate('bbbbaaba') == 'bbbbaaba'
    assert candidate('baa') == 'baa'
    assert candidate('aaaaaa') == 'aaaaaa'
    assert candidate('babbbaa') == 'babbbaa'
    assert candidate('bbaabbabb') == 'bbaabbabb'
    assert candidate('aaaaaba') == 'aaaaaba'
    assert candidate('abaababbaa') == 'abaababbaa'
    assert candidate('b') == 'b'
    assert candidate('a') == 'a'
    assert candidate('babbb') == 'babbb'
    assert candidate('bbabbabbb') == 'bbabbabbb'
    assert candidate('bbbabb') == 'bbbabb'
    assert candidate('bbaaabb') == 'bbaaabb'
    assert candidate('bbaaabba') == 'bbaaabba'
    assert candidate('aab') == 'aab'
    assert candidate('baa') == 'baa'
    assert candidate('abbb') == 'abbb'
    assert candidate('bba') == 'bba'
    assert candidate('aabb') == 'aabb'

Input: aabbaab

Output: aabbaab

Input: bbbbaaaba

Output: bbbbaaaba

Input: baaaabb

Output: baaaabb

Input: aba

Output: aba

Input: bbbb

Output: bbbb

Input: bbbbba

Output: bbbbba

Input: a

Output: a

Input: babbaa

Output: babbaa

Input: a

Output: a

Input: ba

Output: ba

Input: aabbbbaa

Output: aabbbbaa

Input: b

Output: b

Input: bbabaabbaa

Output: bbabaabbaa

Input: babb

Output: babb

Input: baaaabb

Output: baaaabb

Input: bbbaaba

Output: bbbaaba

Input: ba

Output: ba

Input: baabaabaa

Output: baabaabaa

Input: bbbba

Output: bbbba

Input: aa

Output: aa

Input: bbbabbabaa

Output: bbbabbabaa

Input: bbbbaaba

Output: bbbbaaba

Input: baa

Output: baa

Input: aaaaaa

Output: aaaaaa

Input: babbbaa

Output: babbbaa

Input: bbaabbabb

Output: bbaabbabb

Input: aaaaaba

Output: aaaaaba

Input: abaababbaa

Output: abaababbaa

Input: b

Output: b

Input: a

Output: a

Input: babbb

Output: babbb

Input: bbabbabbb

Output: bbabbabbb

Input: bbbabb

Output: bbbabb

Input: bbaaabb

Output: bbaaabb

Input: bbaaabba

Output: bbaaabba

Input: aab

Output: aab

Input: baa

Output: baa

Input: abbb

Output: abbb

Input: bba

Output: bba

Input: aabb

Output: aabb


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('aaaa') == 'bbaabbbaab'
        >>> apply_pipeline('aaabaaaab') == 'bbaababbbaabbbaabb'
        >>> apply_pipeline('babb') == 'babb'
        >>> apply_pipeline('babbabb') == 'babb'
        >>> apply_pipeline('abab') == 'abab'
        >>> apply_pipeline('aabbbaa') == 'bbaabbbbbbaab'
        >>> apply_pipeline('bab') == 'bab'
        >>> apply_pipeline('aabaabb') == 'bbaabbbbaabbb'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('aa', 'bbaab')
    s = s.replace('abba', 'a')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aaaa') == 'bbaabbbaab'
    assert candidate('aaabaaaab') == 'bbaababbbaabbbaabb'
    assert candidate('babb') == 'babb'
    assert candidate('babbabb') == 'babb'
    assert candidate('abab') == 'abab'
    assert candidate('aabbbaa') == 'bbaabbbbbbaab'
    assert candidate('bab') == 'bab'
    assert candidate('aabaabb') == 'bbaabbbbaabbb'

    # hidden tests
    assert candidate('a') == 'a'
    assert candidate('ababbbaabb') == 'ababbbbbaabbb'
    assert candidate('abbbbbba') == 'abbbbbba'
    assert candidate('baba') == 'baba'
    assert candidate('abbbbaabb') == 'abbbbbbaabbb'
    assert candidate('baabbabb') == 'bbbaabbbabb'
    assert candidate('b') == 'b'
    assert candidate('baababaaa') == 'bbbaabbbaaba'
    assert candidate('b') == 'b'
    assert candidate('babab') == 'babab'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('aaa') == 'bbaaba'
    assert candidate('baabaa') == 'bbbaabbbbaab'
    assert candidate('aabbbbbba') == 'bbaabbbbbbba'
    assert candidate('aabbb') == 'bbaabbbb'
    assert candidate('bbbaabaa') == 'bbbbbaabbbbaab'
    assert candidate('aba') == 'aba'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('aaababaaa') == 'bbaabababbbaaba'
    assert candidate('abbaaa') == 'abbbbaaba'
    assert candidate('bbaaabbaa') == 'bbbbaababbbbaab'
    assert candidate('aa') == 'bbaab'
    assert candidate('bbb') == 'bbb'
    assert candidate('ab') == 'ab'
    assert candidate('ababaabba') == 'ababbbaabbba'
    assert candidate('baaabb') == 'bbbaababb'
    assert candidate('bb') == 'bb'
    assert candidate('ba') == 'ba'
    assert candidate('abaaababa') == 'abbbaabababa'
    assert candidate('baaaaaaabb') == 'bbbaabbbaabbbaababb'
    assert candidate('aab') == 'bbaabb'
    assert candidate('a') == 'a'

Input: aaaa

Output: bbaabbbaab

Input: aaabaaaab

Output: bbaababbbaabbbaabb

Input: babb

Output: babb

Input: babbabb

Output: babb

Input: abab

Output: abab

Input: aabbbaa

Output: bbaabbbbbbaab

Input: bab

Output: bab

Input: aabaabb

Output: bbaabbbbaabbb

Input: a

Output: a

Input: ababbbaabb

Output: ababbbbbaabbb

Input: abbbbbba

Output: abbbbbba

Input: baba

Output: baba

Input: abbbbaabb

Output: abbbbbbaabbb

Input: baabbabb

Output: bbbaabbbabb

Input: b

Output: b

Input: baababaaa

Output: bbbaabbbaaba

Input: b

Output: b

Input: babab

Output: babab

Input: bbbb

Output: bbbb

Input: aaa

Output: bbaaba

Input: baabaa

Output: bbbaabbbbaab

Input: aabbbbbba

Output: bbaabbbbbbba

Input: aabbb

Output: bbaabbbb

Input: bbbaabaa

Output: bbbbbaabbbbaab

Input: aba

Output: aba

Input: bbbb

Output: bbbb

Input: aaababaaa

Output: bbaabababbbaaba

Input: abbaaa

Output: abbbbaaba

Input: bbaaabbaa

Output: bbbbaababbbbaab

Input: aa

Output: bbaab

Input: bbb

Output: bbb

Input: ab

Output: ab

Input: ababaabba

Output: ababbbaabbba

Input: baaabb

Output: bbbaababb

Input: bb

Output: bb

Input: ba

Output: ba

Input: abaaababa

Output: abbbaabababa

Input: baaaaaaabb

Output: bbbaabbbaabbbaababb

Input: aab

Output: bbaabb

Input: a

Output: a


Prompt:
from typing import List

def apply_pipeline(s: str) -> str:
    """Apply a fixed string-manipulation pipeline to the input string `s`.

    The pipeline consists of several string method calls such as:

        s = s.replace(old, new)
        s = s.upper()
        s = s.lower()
        s = s.strip(chars)

    which are always applied in the same fixed order.

    Your task is to reverse-engineer this pipeline from the examples
    and implement it.

    Example input/output pairs:

        >>> apply_pipeline('baabbb') == 'baabbb'
        >>> apply_pipeline('abbbb') == 'abbbb'
        >>> apply_pipeline('abaaba') == 'abaaba'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('bababbbbba') == 'bababbbaaa'
        >>> apply_pipeline('baaba') == 'baaba'
        >>> apply_pipeline('aaaaaaaab') == 'aaaaaaaab'
        >>> apply_pipeline('aaa') == 'aaa'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.lower()
    s = s.replace('bba', 'aaa')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baabbb') == 'baabbb'
    assert candidate('abbbb') == 'abbbb'
    assert candidate('abaaba') == 'abaaba'
    assert candidate('a') == 'a'
    assert candidate('bababbbbba') == 'bababbbaaa'
    assert candidate('baaba') == 'baaba'
    assert candidate('aaaaaaaab') == 'aaaaaaaab'
    assert candidate('aaa') == 'aaa'

    # hidden tests
    assert candidate('ababbabaa') == 'abaaaabaa'
    assert candidate('ab') == 'ab'
    assert candidate('aaaabaaaa') == 'aaaabaaaa'
    assert candidate('bababbbbab') == 'bababbaaab'
    assert candidate('bbbbab') == 'bbaaab'
    assert candidate('baab') == 'baab'
    assert candidate('bbb') == 'bbb'
    assert candidate('aba') == 'aba'
    assert candidate('aabaab') == 'aabaab'
    assert candidate('a') == 'a'
    assert candidate('bbaab') == 'aaaab'
    assert candidate('abb') == 'abb'
    assert candidate('bbbbaab') == 'bbaaaab'
    assert candidate('bbaaa') == 'aaaaa'
    assert candidate('baaabbaa') == 'baaaaaaa'
    assert candidate('abaaab') == 'abaaab'
    assert candidate('abbaa') == 'aaaaa'
    assert candidate('ab') == 'ab'
    assert candidate('bb') == 'bb'
    assert candidate('abbbbb') == 'abbbbb'
    assert candidate('aaaba') == 'aaaba'
    assert candidate('ba') == 'ba'
    assert candidate('abba') == 'aaaa'
    assert candidate('bbaaaaabab') == 'aaaaaaabab'
    assert candidate('bbbba') == 'bbaaa'
    assert candidate('abbaaabab') == 'aaaaaabab'
    assert candidate('babbaabbaa') == 'baaaaaaaaa'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('bbab') == 'aaab'
    assert candidate('b') == 'b'
    assert candidate('aababbbb') == 'aababbbb'
    assert candidate('bbabaabb') == 'aaabaabb'

Input: baabbb

Output: baabbb

Input: abbbb

Output: abbbb

Input: abaaba

Output: abaaba

Input: a

Output: a

Input: bababbbbba

Output: bababbbaaa

Input: baaba

Output: baaba

Input: aaaaaaaab

Output: aaaaaaaab

Input: aaa

Output: aaa

Input: ababbabaa

Output: abaaaabaa

Input: ab

Output: ab

Input: aaaabaaaa

Output: aaaabaaaa

Input: bababbbbab

Output: bababbaaab

Input: bbbbab

Output: bbaaab

Input: baab

Output: baab

Input: bbb

Output: bbb

Input: aba

Output: aba

Input: aabaab

Output: aabaab

Input: a

Output: a

Input: bbaab

Output: aaaab

Input: abb

Output: abb

Input: bbbbaab

Output: bbaaaab

Input: bbaaa

Output: aaaaa

Input: baaabbaa

Output: baaaaaaa

Input: abaaab

Output: abaaab

Input: abbaa

Output: aaaaa

Input: ab

Output: ab

Input: bb

Output: bb

Input: abbbbb

Output: abbbbb

Input: aaaba

Output: aaaba

Input: ba

Output: ba

Input: abba

Output: aaaa

Input: bbaaaaabab

Output: aaaaaaabab

Input: bbbba

Output: bbaaa

Input: abbaaabab

Output: aaaaaabab

Input: babbaabbaa

Output: baaaaaaaaa

Input: aaaa

Output: aaaa

Input: bbab

Output: aaab

Input: b

Output: b

Input: aababbbb

Output: aababbbb

Input: bbabaabb

Output: aaabaabb