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('bbaabbbba') == 'BBAABBBBA'
        >>> apply_pipeline('bababbabb') == 'BABABBABB'
        >>> apply_pipeline('bbb') == 'BBB'
        >>> apply_pipeline('aabbb') == 'AABBB'
        >>> apply_pipeline('baaabab') == 'BBAAABB'
        >>> apply_pipeline('babbbbaabb') == 'BABBBBAABB'
        >>> apply_pipeline('aabababa') == 'AABABABA'
        >>> apply_pipeline('a') == 'A'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbaabbbba') == 'BBAABBBBA'
    assert candidate('bababbabb') == 'BABABBABB'
    assert candidate('bbb') == 'BBB'
    assert candidate('aabbb') == 'AABBB'
    assert candidate('baaabab') == 'BBAAABB'
    assert candidate('babbbbaabb') == 'BABBBBAABB'
    assert candidate('aabababa') == 'AABABABA'
    assert candidate('a') == 'A'

    # hidden tests
    assert candidate('bbbbbb') == 'BBBBBB'
    assert candidate('aababaaaab') == 'AABABAAAAB'
    assert candidate('babaabaaa') == 'BABAABAAA'
    assert candidate('baabbbbaba') == 'BAABBBBABA'
    assert candidate('ababba') == 'ABABBA'
    assert candidate('bbba') == 'BBBA'
    assert candidate('abbabb') == 'ABBABB'
    assert candidate('aaba') == 'AABA'
    assert candidate('bbbbaabbab') == 'BBBBAABBAB'
    assert candidate('abaa') == 'ABAA'
    assert candidate('bb') == 'BB'
    assert candidate('baaabaaaa') == 'BBAAABAAA'
    assert candidate('bbbababab') == 'BBBABABAB'
    assert candidate('aaabbb') == 'AAABBB'
    assert candidate('bbbaaaaa') == 'BBBAAAAA'
    assert candidate('bbbbbabaab') == 'BBBBBABAAB'
    assert candidate('babbbbba') == 'BABBBBBA'
    assert candidate('aab') == 'AAB'
    assert candidate('bbabbaabb') == 'BBABBAABB'
    assert candidate('baabbaab') == 'BAABBAAB'
    assert candidate('aaa') == 'AAA'
    assert candidate('a') == 'A'
    assert candidate('aabababbb') == 'AABABABBB'
    assert candidate('abbaabbbb') == 'ABBAABBBB'
    assert candidate('ab') == 'AB'
    assert candidate('ba') == 'BA'
    assert candidate('abab') == 'ABAB'
    assert candidate('babab') == 'BABAB'
    assert candidate('ba') == 'BA'
    assert candidate('aaaabaabb') == 'ABAAABABB'
    assert candidate('bab') == 'BAB'
    assert candidate('aaaaa') == 'AAAAA'

Input: bbaabbbba

Output: BBAABBBBA

Input: bababbabb

Output: BABABBABB

Input: bbb

Output: BBB

Input: aabbb

Output: AABBB

Input: baaabab

Output: BBAAABB

Input: babbbbaabb

Output: BABBBBAABB

Input: aabababa

Output: AABABABA

Input: a

Output: A

Input: bbbbbb

Output: BBBBBB

Input: aababaaaab

Output: AABABAAAAB

Input: babaabaaa

Output: BABAABAAA

Input: baabbbbaba

Output: BAABBBBABA

Input: ababba

Output: ABABBA

Input: bbba

Output: BBBA

Input: abbabb

Output: ABBABB

Input: aaba

Output: AABA

Input: bbbbaabbab

Output: BBBBAABBAB

Input: abaa

Output: ABAA

Input: bb

Output: BB

Input: baaabaaaa

Output: BBAAABAAA

Input: bbbababab

Output: BBBABABAB

Input: aaabbb

Output: AAABBB

Input: bbbaaaaa

Output: BBBAAAAA

Input: bbbbbabaab

Output: BBBBBABAAB

Input: babbbbba

Output: BABBBBBA

Input: aab

Output: AAB

Input: bbabbaabb

Output: BBABBAABB

Input: baabbaab

Output: BAABBAAB

Input: aaa

Output: AAA

Input: a

Output: A

Input: aabababbb

Output: AABABABBB

Input: abbaabbbb

Output: ABBAABBBB

Input: ab

Output: AB

Input: ba

Output: BA

Input: abab

Output: ABAB

Input: babab

Output: BABAB

Input: ba

Output: BA

Input: aaaabaabb

Output: ABAAABABB

Input: bab

Output: BAB

Input: aaaaa

Output: AAAAA


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('bbbbaabbbb') == 'bbbbaabbbb'
        >>> apply_pipeline('bbaabbaaa') == 'bbaabbaaa'
        >>> apply_pipeline('bbbbbb') == 'bbbbbb'
        >>> apply_pipeline('aabbab') == 'aabbab'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('babbababbb') == 'babbababbb'
        >>> apply_pipeline('bbbaaab') == 'bbbaaab'
    """
    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('a') == 'a'
    assert candidate('bbbbaabbbb') == 'bbbbaabbbb'
    assert candidate('bbaabbaaa') == 'bbaabbaaa'
    assert candidate('bbbbbb') == 'bbbbbb'
    assert candidate('aabbab') == 'aabbab'
    assert candidate('b') == 'b'
    assert candidate('babbababbb') == 'babbababbb'
    assert candidate('bbbaaab') == 'bbbaaab'

    # hidden tests
    assert candidate('bbbabaaba') == 'bbbabaaba'
    assert candidate('baabaa') == 'baabaa'
    assert candidate('aaabb') == 'aaabb'
    assert candidate('ab') == 'ab'
    assert candidate('aababaabbb') == 'aababaabbb'
    assert candidate('bbbbaaaaab') == 'bbbbaaaaab'
    assert candidate('baa') == 'baa'
    assert candidate('bbbbaaaaa') == 'bbbbaaaaa'
    assert candidate('aa') == 'aa'
    assert candidate('bab') == 'bab'
    assert candidate('aa') == 'aa'
    assert candidate('bbbbbaabb') == 'bbbbbaabb'
    assert candidate('bbbbaaa') == 'bbbbaaa'
    assert candidate('abbbb') == 'abbbb'
    assert candidate('bb') == 'bb'
    assert candidate('abb') == 'abb'
    assert candidate('baabba') == 'baabba'
    assert candidate('a') == 'a'
    assert candidate('baabbabb') == 'baabbabb'
    assert candidate('ababbbabb') == 'ababbbabb'
    assert candidate('a') == 'a'
    assert candidate('bbabaaba') == 'bbabaaba'
    assert candidate('aaaabaabab') == 'aaaabaabab'
    assert candidate('ba') == 'ba'
    assert candidate('abbababbaa') == 'abbababbaa'
    assert candidate('abaa') == 'abaa'
    assert candidate('ababaabb') == 'ababaabb'
    assert candidate('babbabaaa') == 'babbabaaa'
    assert candidate('aab') == 'aab'
    assert candidate('aaaabbaaba') == 'aaaabbaaba'
    assert candidate('bab') == 'bab'
    assert candidate('ababb') == 'ababb'

Input: a

Output: a

Input: bbbbaabbbb

Output: bbbbaabbbb

Input: bbaabbaaa

Output: bbaabbaaa

Input: bbbbbb

Output: bbbbbb

Input: aabbab

Output: aabbab

Input: b

Output: b

Input: babbababbb

Output: babbababbb

Input: bbbaaab

Output: bbbaaab

Input: bbbabaaba

Output: bbbabaaba

Input: baabaa

Output: baabaa

Input: aaabb

Output: aaabb

Input: ab

Output: ab

Input: aababaabbb

Output: aababaabbb

Input: bbbbaaaaab

Output: bbbbaaaaab

Input: baa

Output: baa

Input: bbbbaaaaa

Output: bbbbaaaaa

Input: aa

Output: aa

Input: bab

Output: bab

Input: aa

Output: aa

Input: bbbbbaabb

Output: bbbbbaabb

Input: bbbbaaa

Output: bbbbaaa

Input: abbbb

Output: abbbb

Input: bb

Output: bb

Input: abb

Output: abb

Input: baabba

Output: baabba

Input: a

Output: a

Input: baabbabb

Output: baabbabb

Input: ababbbabb

Output: ababbbabb

Input: a

Output: a

Input: bbabaaba

Output: bbabaaba

Input: aaaabaabab

Output: aaaabaabab

Input: ba

Output: ba

Input: abbababbaa

Output: abbababbaa

Input: abaa

Output: abaa

Input: ababaabb

Output: ababaabb

Input: babbabaaa

Output: babbabaaa

Input: aab

Output: aab

Input: aaaabbaaba

Output: aaaabbaaba

Input: bab

Output: bab

Input: ababb

Output: ababb


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('aababab') == 'aababab'
        >>> apply_pipeline('ababbbb') == 'ababbbb'
        >>> apply_pipeline('aaaab') == 'aaaab'
        >>> apply_pipeline('abb') == 'abb'
        >>> apply_pipeline('bbaababa') == 'bbaababa'
        >>> apply_pipeline('bbab') == 'bbab'
        >>> apply_pipeline('bbbaab') == 'bbbaab'
        >>> apply_pipeline('abbbabbb') == 'abbbabbb'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aababab') == 'aababab'
    assert candidate('ababbbb') == 'ababbbb'
    assert candidate('aaaab') == 'aaaab'
    assert candidate('abb') == 'abb'
    assert candidate('bbaababa') == 'bbaababa'
    assert candidate('bbab') == 'bbab'
    assert candidate('bbbaab') == 'bbbaab'
    assert candidate('abbbabbb') == 'abbbabbb'

    # hidden tests
    assert candidate('aa') == 'aa'
    assert candidate('bbb') == 'bbb'
    assert candidate('babaab') == 'babaab'
    assert candidate('aaabab') == 'aaabab'
    assert candidate('bbaab') == 'bbaab'
    assert candidate('ba') == 'ba'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('babbab') == 'babbab'
    assert candidate('ababbabaa') == 'ababbabaa'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('abaa') == 'abaa'
    assert candidate('bbbbbbabbb') == 'bbbbbbabbb'
    assert candidate('babbaa') == 'babbaa'
    assert candidate('bbaabba') == 'bbaabba'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('baaabbba') == 'baaabbba'
    assert candidate('babab') == 'babab'
    assert candidate('aabaaabaab') == 'aabaaabaab'
    assert candidate('bbabbbbab') == 'bbabbbbab'
    assert candidate('babbbbbaa') == 'babbbbbaa'
    assert candidate('babbaab') == 'babbaab'
    assert candidate('bbbaaaaaba') == 'bbabbaaba'
    assert candidate('aababa') == 'aababa'
    assert candidate('baabbaabab') == 'baabbaabab'
    assert candidate('baa') == 'baa'
    assert candidate('bbab') == 'bbab'
    assert candidate('abab') == 'abab'
    assert candidate('aba') == 'aba'
    assert candidate('a') == 'a'
    assert candidate('bbabbaa') == 'bbabbaa'
    assert candidate('babbabbb') == 'babbabbb'
    assert candidate('aaabaab') == 'aaabaab'

Input: aababab

Output: aababab

Input: ababbbb

Output: ababbbb

Input: aaaab

Output: aaaab

Input: abb

Output: abb

Input: bbaababa

Output: bbaababa

Input: bbab

Output: bbab

Input: bbbaab

Output: bbbaab

Input: abbbabbb

Output: abbbabbb

Input: aa

Output: aa

Input: bbb

Output: bbb

Input: babaab

Output: babaab

Input: aaabab

Output: aaabab

Input: bbaab

Output: bbaab

Input: ba

Output: ba

Input: bbaa

Output: bbaa

Input: babbab

Output: babbab

Input: ababbabaa

Output: ababbabaa

Input: abbbbaa

Output: abbbbaa

Input: abaa

Output: abaa

Input: bbbbbbabbb

Output: bbbbbbabbb

Input: babbaa

Output: babbaa

Input: bbaabba

Output: bbaabba

Input: bbbb

Output: bbbb

Input: baaabbba

Output: baaabbba

Input: babab

Output: babab

Input: aabaaabaab

Output: aabaaabaab

Input: bbabbbbab

Output: bbabbbbab

Input: babbbbbaa

Output: babbbbbaa

Input: babbaab

Output: babbaab

Input: bbbaaaaaba

Output: bbabbaaba

Input: aababa

Output: aababa

Input: baabbaabab

Output: baabbaabab

Input: baa

Output: baa

Input: bbab

Output: bbab

Input: abab

Output: abab

Input: aba

Output: aba

Input: a

Output: a

Input: bbabbaa

Output: bbabbaa

Input: babbabbb

Output: babbabbb

Input: aaabaab

Output: aaabaab


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('aababa') == 'AAB'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aabbaaaa') == 'AABBAAAA'
        >>> apply_pipeline('aaabaabbbb') == 'AAABAABBBB'
        >>> apply_pipeline('aabaabaaa') == 'AABAABAAA'
        >>> apply_pipeline('abbb') == 'ABBB'
        >>> apply_pipeline('bbbabaaba') == 'BBBABAABA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aababa') == 'AAB'
    assert candidate('ba') == 'BA'
    assert candidate('b') == 'B'
    assert candidate('aabbaaaa') == 'AABBAAAA'
    assert candidate('aaabaabbbb') == 'AAABAABBBB'
    assert candidate('aabaabaaa') == 'AABAABAAA'
    assert candidate('abbb') == 'ABBB'
    assert candidate('bbbabaaba') == 'BBBABAABA'

    # hidden tests
    assert candidate('baabaa') == 'BAABAA'
    assert candidate('abbbaaab') == 'ABBBAAAB'
    assert candidate('baabba') == 'BAABBA'
    assert candidate('bbabbaaa') == 'BBABBAAA'
    assert candidate('bbbaaba') == 'BBBAABA'
    assert candidate('babbbbaaaa') == 'BABBBBAAAA'
    assert candidate('aabaabbbb') == 'AABAABBBB'
    assert candidate('baa') == 'BAA'
    assert candidate('bbbabbabaa') == 'BBBABBABAA'
    assert candidate('bbab') == 'BBAB'
    assert candidate('bbab') == 'BBAB'
    assert candidate('aaaabaaaaa') == 'AAAABAAAAA'
    assert candidate('babbaaaba') == 'BABBAAABA'
    assert candidate('baabaab') == 'BAABAAB'
    assert candidate('ba') == 'BA'
    assert candidate('ababbbaa') == 'ABABBBAA'
    assert candidate('aaaaaaa') == 'AAAAAAA'
    assert candidate('bbbaaabb') == 'BBBAAABB'
    assert candidate('abaab') == 'ABAAB'
    assert candidate('babbbab') == 'BABBBAB'
    assert candidate('aabba') == 'AABBA'
    assert candidate('baaaa') == 'BAAAA'
    assert candidate('aaaabaaabb') == 'AAAABAAABB'
    assert candidate('babaaaabaa') == 'BABAAAABAA'
    assert candidate('b') == 'B'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('baababaaba') == 'BAABABA'
    assert candidate('baaaabaab') == 'BAAAABAAB'
    assert candidate('ab') == 'AB'
    assert candidate('bbaabbbb') == 'BBAABBBB'
    assert candidate('bba') == 'BBA'
    assert candidate('baaaaaaa') == 'BAAAAAAA'

Input: aababa

Output: AAB

Input: ba

Output: BA

Input: b

Output: B

Input: aabbaaaa

Output: AABBAAAA

Input: aaabaabbbb

Output: AAABAABBBB

Input: aabaabaaa

Output: AABAABAAA

Input: abbb

Output: ABBB

Input: bbbabaaba

Output: BBBABAABA

Input: baabaa

Output: BAABAA

Input: abbbaaab

Output: ABBBAAAB

Input: baabba

Output: BAABBA

Input: bbabbaaa

Output: BBABBAAA

Input: bbbaaba

Output: BBBAABA

Input: babbbbaaaa

Output: BABBBBAAAA

Input: aabaabbbb

Output: AABAABBBB

Input: baa

Output: BAA

Input: bbbabbabaa

Output: BBBABBABAA

Input: bbab

Output: BBAB

Input: bbab

Output: BBAB

Input: aaaabaaaaa

Output: AAAABAAAAA

Input: babbaaaba

Output: BABBAAABA

Input: baabaab

Output: BAABAAB

Input: ba

Output: BA

Input: ababbbaa

Output: ABABBBAA

Input: aaaaaaa

Output: AAAAAAA

Input: bbbaaabb

Output: BBBAAABB

Input: abaab

Output: ABAAB

Input: babbbab

Output: BABBBAB

Input: aabba

Output: AABBA

Input: baaaa

Output: BAAAA

Input: aaaabaaabb

Output: AAAABAAABB

Input: babaaaabaa

Output: BABAAAABAA

Input: b

Output: B

Input: bbbb

Output: BBBB

Input: baababaaba

Output: BAABABA

Input: baaaabaab

Output: BAAAABAAB

Input: ab

Output: AB

Input: bbaabbbb

Output: BBAABBBB

Input: bba

Output: BBA

Input: baaaaaaa

Output: BAAAAAAA


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('ab') == 'AB'
        >>> apply_pipeline('abba') == 'ABBA'
        >>> apply_pipeline('babbabbbaa') == 'BABBABBBAA'
        >>> apply_pipeline('aababbaaba') == 'AABABBAABA'
        >>> apply_pipeline('aaba') == 'AABA'
        >>> apply_pipeline('baab') == 'BAAB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bb') == 'BB'
    """
    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('ab') == 'AB'
    assert candidate('abba') == 'ABBA'
    assert candidate('babbabbbaa') == 'BABBABBBAA'
    assert candidate('aababbaaba') == 'AABABBAABA'
    assert candidate('aaba') == 'AABA'
    assert candidate('baab') == 'BAAB'
    assert candidate('b') == 'B'
    assert candidate('bb') == 'BB'

    # hidden tests
    assert candidate('abbaab') == 'ABBAAB'
    assert candidate('bababb') == 'BABABB'
    assert candidate('bbbaab') == 'BBBAAB'
    assert candidate('a') == 'A'
    assert candidate('bbab') == 'BBAB'
    assert candidate('aaaabbabbb') == 'AAAABBABBB'
    assert candidate('bab') == 'BAB'
    assert candidate('ababaaabab') == 'ABABAAABAB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('aaba') == 'AABA'
    assert candidate('b') == 'B'
    assert candidate('bababbbb') == 'BABABBBB'
    assert candidate('bbbab') == 'BBBAB'
    assert candidate('baabaaabb') == 'BAABAAABB'
    assert candidate('ab') == 'AB'
    assert candidate('abbabbbba') == 'ABBABBBBA'
    assert candidate('aba') == 'ABA'
    assert candidate('baabab') == 'BAABAB'
    assert candidate('babbababbb') == 'BABBABABBB'
    assert candidate('ababaa') == 'ABABAA'
    assert candidate('aaabaa') == 'AAABAA'
    assert candidate('aaab') == 'AAAB'
    assert candidate('ba') == 'BA'
    assert candidate('bb') == 'BB'
    assert candidate('bbabaab') == 'BBABAAB'
    assert candidate('abbbaa') == 'ABBBAA'
    assert candidate('baaba') == 'BAABA'
    assert candidate('babaaa') == 'BABAAA'
    assert candidate('aaaaab') == 'AAAAAB'
    assert candidate('babaaab') == 'BABAAAB'
    assert candidate('aba') == 'ABA'
    assert candidate('bab') == 'BAB'

Input: ab

Output: AB

Input: abba

Output: ABBA

Input: babbabbbaa

Output: BABBABBBAA

Input: aababbaaba

Output: AABABBAABA

Input: aaba

Output: AABA

Input: baab

Output: BAAB

Input: b

Output: B

Input: bb

Output: BB

Input: abbaab

Output: ABBAAB

Input: bababb

Output: BABABB

Input: bbbaab

Output: BBBAAB

Input: a

Output: A

Input: bbab

Output: BBAB

Input: aaaabbabbb

Output: AAAABBABBB

Input: bab

Output: BAB

Input: ababaaabab

Output: ABABAAABAB

Input: aaab

Output: AAAB

Input: aaba

Output: AABA

Input: b

Output: B

Input: bababbbb

Output: BABABBBB

Input: bbbab

Output: BBBAB

Input: baabaaabb

Output: BAABAAABB

Input: ab

Output: AB

Input: abbabbbba

Output: ABBABBBBA

Input: aba

Output: ABA

Input: baabab

Output: BAABAB

Input: babbababbb

Output: BABBABABBB

Input: ababaa

Output: ABABAA

Input: aaabaa

Output: AAABAA

Input: aaab

Output: AAAB

Input: ba

Output: BA

Input: bb

Output: BB

Input: bbabaab

Output: BBABAAB

Input: abbbaa

Output: ABBBAA

Input: baaba

Output: BAABA

Input: babaaa

Output: BABAAA

Input: aaaaab

Output: AAAAAB

Input: babaaab

Output: BABAAAB

Input: aba

Output: ABA

Input: bab

Output: BAB


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('abbbbbab') == 'ABBBBBAB'
        >>> apply_pipeline('abbb') == 'ABBB'
        >>> apply_pipeline('aaaaaaba') == 'AAAAAABA'
        >>> apply_pipeline('aaabba') == 'AAABBA'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('baabba') == 'BAABBA'
        >>> apply_pipeline('baab') == 'BAAB'
        >>> apply_pipeline('aaba') == 'AABA'
    """
    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('abbbbbab') == 'ABBBBBAB'
    assert candidate('abbb') == 'ABBB'
    assert candidate('aaaaaaba') == 'AAAAAABA'
    assert candidate('aaabba') == 'AAABBA'
    assert candidate('aa') == 'AA'
    assert candidate('baabba') == 'BAABBA'
    assert candidate('baab') == 'BAAB'
    assert candidate('aaba') == 'AABA'

    # hidden tests
    assert candidate('abbbbbab') == 'ABBBBBAB'
    assert candidate('baababbab') == 'BAABABBAB'
    assert candidate('b') == 'B'
    assert candidate('aabba') == 'AABBA'
    assert candidate('ababbbb') == 'ABABBBB'
    assert candidate('bbbbbbba') == 'BBBBBBBA'
    assert candidate('aaaaabbbb') == 'AAAAABBBB'
    assert candidate('ababa') == 'ABABA'
    assert candidate('bbbaaabab') == 'BBBAAABAB'
    assert candidate('babaababa') == 'BABAABABA'
    assert candidate('aabbbaa') == 'AABBBAA'
    assert candidate('baaaaaaa') == 'BAAAAAAA'
    assert candidate('abbaaa') == 'ABBAAA'
    assert candidate('abbbb') == 'ABBBB'
    assert candidate('abbaaa') == 'ABBAAA'
    assert candidate('bab') == 'BAB'
    assert candidate('bba') == 'BBA'
    assert candidate('ab') == 'AB'
    assert candidate('aa') == 'AA'
    assert candidate('bbbaabb') == 'BBBAABB'
    assert candidate('ababbbabaa') == 'ABABBBABAA'
    assert candidate('bba') == 'BBA'
    assert candidate('ab') == 'AB'
    assert candidate('abbab') == 'ABBAB'
    assert candidate('bba') == 'BBA'
    assert candidate('babbaaabb') == 'BABBAAABB'
    assert candidate('bbabbaba') == 'BBABBABA'
    assert candidate('aab') == 'AAB'
    assert candidate('abbbabb') == 'ABBBABB'
    assert candidate('bbbbab') == 'BBBBAB'
    assert candidate('abbba') == 'ABBBA'
    assert candidate('abaaaaaa') == 'ABAAAAAA'

Input: abbbbbab

Output: ABBBBBAB

Input: abbb

Output: ABBB

Input: aaaaaaba

Output: AAAAAABA

Input: aaabba

Output: AAABBA

Input: aa

Output: AA

Input: baabba

Output: BAABBA

Input: baab

Output: BAAB

Input: aaba

Output: AABA

Input: abbbbbab

Output: ABBBBBAB

Input: baababbab

Output: BAABABBAB

Input: b

Output: B

Input: aabba

Output: AABBA

Input: ababbbb

Output: ABABBBB

Input: bbbbbbba

Output: BBBBBBBA

Input: aaaaabbbb

Output: AAAAABBBB

Input: ababa

Output: ABABA

Input: bbbaaabab

Output: BBBAAABAB

Input: babaababa

Output: BABAABABA

Input: aabbbaa

Output: AABBBAA

Input: baaaaaaa

Output: BAAAAAAA

Input: abbaaa

Output: ABBAAA

Input: abbbb

Output: ABBBB

Input: abbaaa

Output: ABBAAA

Input: bab

Output: BAB

Input: bba

Output: BBA

Input: ab

Output: AB

Input: aa

Output: AA

Input: bbbaabb

Output: BBBAABB

Input: ababbbabaa

Output: ABABBBABAA

Input: bba

Output: BBA

Input: ab

Output: AB

Input: abbab

Output: ABBAB

Input: bba

Output: BBA

Input: babbaaabb

Output: BABBAAABB

Input: bbabbaba

Output: BBABBABA

Input: aab

Output: AAB

Input: abbbabb

Output: ABBBABB

Input: bbbbab

Output: BBBBAB

Input: abbba

Output: ABBBA

Input: abaaaaaa

Output: ABAAAAAA


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('bbbbbaab') == 'BBBBBABABAAB'
        >>> apply_pipeline('aaaaabaabb') == 'AAAABABAABABABAABB'
        >>> apply_pipeline('bababaab') == 'BBABAABBABAABABABAAB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('ab') == 'BABAAB'
        >>> apply_pipeline('abbaabba') == 'BABAABBABABAABBA'
        >>> apply_pipeline('aaaabba') == 'AAABABAABBA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.replace('AB', 'bba')
    s = s.replace('ba', 'abaab')
    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('bbbbbaab') == 'BBBBBABABAAB'
    assert candidate('aaaaabaabb') == 'AAAABABAABABABAABB'
    assert candidate('bababaab') == 'BBABAABBABAABABABAAB'
    assert candidate('b') == 'B'
    assert candidate('aaa') == 'AAA'
    assert candidate('ab') == 'BABAAB'
    assert candidate('abbaabba') == 'BABAABBABABAABBA'
    assert candidate('aaaabba') == 'AAABABAABBA'

    # hidden tests
    assert candidate('aabaa') == 'ABABAABAA'
    assert candidate('b') == 'B'
    assert candidate('bbabbabbb') == 'BBBABAABBBABAABBB'
    assert candidate('bab') == 'BBABAAB'
    assert candidate('aaabaa') == 'AABABAABAA'
    assert candidate('aaa') == 'AAA'
    assert candidate('abbb') == 'BABAABBB'
    assert candidate('bb') == 'BB'
    assert candidate('bb') == 'BB'
    assert candidate('abbaaabaa') == 'BABAABBAABABAABAA'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('aabb') == 'ABABAABB'
    assert candidate('babbaba') == 'BBABAABBBABAABA'
    assert candidate('a') == 'A'
    assert candidate('aaabababab') == 'AABABAABBABAABBABAABBABAAB'
    assert candidate('aabb') == 'ABABAABB'
    assert candidate('bbaabbabb') == 'BBABABAABBBABAABB'
    assert candidate('abbabba') == 'BABAABBBABAABBA'
    assert candidate('aab') == 'ABABAAB'
    assert candidate('aa') == 'AA'
    assert candidate('babbbaabaa') == 'BBABAABBBABABAABAA'
    assert candidate('aaaba') == 'AABABAABA'
    assert candidate('bbbbabbb') == 'BBBBBABAABBB'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('aababbbaaa') == 'ABABAABBABAABBBAAA'
    assert candidate('aabbab') == 'ABABAABBBABAAB'
    assert candidate('abaabab') == 'BABAABABABAABBABAAB'
    assert candidate('aaabaaaa') == 'AABABAABAAAA'
    assert candidate('bbba') == 'BBBA'
    assert candidate('baaaabbaab') == 'BAAABABAABBABABAAB'
    assert candidate('bbaaaab') == 'BBAAABABAAB'

Input: bbbbbaab

Output: BBBBBABABAAB

Input: aaaaabaabb

Output: AAAABABAABABABAABB

Input: bababaab

Output: BBABAABBABAABABABAAB

Input: b

Output: B

Input: aaa

Output: AAA

Input: ab

Output: BABAAB

Input: abbaabba

Output: BABAABBABABAABBA

Input: aaaabba

Output: AAABABAABBA

Input: aabaa

Output: ABABAABAA

Input: b

Output: B

Input: bbabbabbb

Output: BBBABAABBBABAABBB

Input: bab

Output: BBABAAB

Input: aaabaa

Output: AABABAABAA

Input: aaa

Output: AAA

Input: abbb

Output: BABAABBB

Input: bb

Output: BB

Input: bb

Output: BB

Input: abbaaabaa

Output: BABAABBAABABAABAA

Input: aaaaa

Output: AAAAA

Input: baaa

Output: BAAA

Input: aabb

Output: ABABAABB

Input: babbaba

Output: BBABAABBBABAABA

Input: a

Output: A

Input: aaabababab

Output: AABABAABBABAABBABAABBABAAB

Input: aabb

Output: ABABAABB

Input: bbaabbabb

Output: BBABABAABBBABAABB

Input: abbabba

Output: BABAABBBABAABBA

Input: aab

Output: ABABAAB

Input: aa

Output: AA

Input: babbbaabaa

Output: BBABAABBBABABAABAA

Input: aaaba

Output: AABABAABA

Input: bbbbabbb

Output: BBBBBABAABBB

Input: aaaa

Output: AAAA

Input: aababbbaaa

Output: ABABAABBABAABBBAAA

Input: aabbab

Output: ABABAABBBABAAB

Input: abaabab

Output: BABAABABABAABBABAAB

Input: aaabaaaa

Output: AABABAABAAAA

Input: bbba

Output: BBBA

Input: baaaabbaab

Output: BAAABABAABBABABAAB

Input: bbaaaab

Output: BBAAABABAAB


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('baabbbaa') == 'BAABBBAA'
        >>> apply_pipeline('bbababa') == 'BBABABA'
        >>> apply_pipeline('aab') == 'AAB'
        >>> apply_pipeline('baaaabbb') == 'BAAAABBB'
        >>> apply_pipeline('abbbababa') == 'ABBBABABA'
        >>> apply_pipeline('ab') == 'AB'
        >>> apply_pipeline('aaab') == 'AAAB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.replace('BABB', 'a')
    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('baabbbaa') == 'BAABBBAA'
    assert candidate('bbababa') == 'BBABABA'
    assert candidate('aab') == 'AAB'
    assert candidate('baaaabbb') == 'BAAAABBB'
    assert candidate('abbbababa') == 'ABBBABABA'
    assert candidate('ab') == 'AB'
    assert candidate('aaab') == 'AAAB'

    # hidden tests
    assert candidate('bab') == 'BAB'
    assert candidate('a') == 'A'
    assert candidate('ba') == 'BA'
    assert candidate('ababa') == 'ABABA'
    assert candidate('bbba') == 'BBBA'
    assert candidate('ab') == 'AB'
    assert candidate('aaaaabaaa') == 'AAAAABAAA'
    assert candidate('babbaba') == 'AABA'
    assert candidate('baabbb') == 'BAABBB'
    assert candidate('aabbaabbab') == 'AABBAABBAB'
    assert candidate('abaaaabbbb') == 'ABAAAABBBB'
    assert candidate('bbbbbbba') == 'BBBBBBBA'
    assert candidate('babbabbb') == 'AABBB'
    assert candidate('abbaa') == 'ABBAA'
    assert candidate('babbbb') == 'ABB'
    assert candidate('baababbaba') == 'BAAAABA'
    assert candidate('ba') == 'BA'
    assert candidate('babb') == 'A'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('babababba') == 'BABAAA'
    assert candidate('ab') == 'AB'
    assert candidate('bbbababb') == 'BBBAA'
    assert candidate('abbbbaaaab') == 'ABBBBAAAAB'
    assert candidate('a') == 'A'
    assert candidate('ba') == 'BA'
    assert candidate('baabaaaaa') == 'BAABAAAAA'
    assert candidate('bbbaaa') == 'BBBAAA'
    assert candidate('bbaaabaaba') == 'BBAAABAABA'
    assert candidate('aaabbaaab') == 'AAABBAAAB'
    assert candidate('abaa') == 'ABAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('bbbaa') == 'BBBAA'

Input: bbab

Output: BBAB

Input: baabbbaa

Output: BAABBBAA

Input: bbababa

Output: BBABABA

Input: aab

Output: AAB

Input: baaaabbb

Output: BAAAABBB

Input: abbbababa

Output: ABBBABABA

Input: ab

Output: AB

Input: aaab

Output: AAAB

Input: bab

Output: BAB

Input: a

Output: A

Input: ba

Output: BA

Input: ababa

Output: ABABA

Input: bbba

Output: BBBA

Input: ab

Output: AB

Input: aaaaabaaa

Output: AAAAABAAA

Input: babbaba

Output: AABA

Input: baabbb

Output: BAABBB

Input: aabbaabbab

Output: AABBAABBAB

Input: abaaaabbbb

Output: ABAAAABBBB

Input: bbbbbbba

Output: BBBBBBBA

Input: babbabbb

Output: AABBB

Input: abbaa

Output: ABBAA

Input: babbbb

Output: ABB

Input: baababbaba

Output: BAAAABA

Input: ba

Output: BA

Input: babb

Output: A

Input: bbbb

Output: BBBB

Input: babababba

Output: BABAAA

Input: ab

Output: AB

Input: bbbababb

Output: BBBAA

Input: abbbbaaaab

Output: ABBBBAAAAB

Input: a

Output: A

Input: ba

Output: BA

Input: baabaaaaa

Output: BAABAAAAA

Input: bbbaaa

Output: BBBAAA

Input: bbaaabaaba

Output: BBAAABAABA

Input: aaabbaaab

Output: AAABBAAAB

Input: abaa

Output: ABAA

Input: baaa

Output: BAAA

Input: bbbaa

Output: BBBAA


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('aababa') == 'ABBABBBABBBABB'
        >>> apply_pipeline('aba') == 'ABBBABB'
        >>> apply_pipeline('ba') == 'BABB'
        >>> apply_pipeline('aaaaaa') == 'ABBABBABBABBABBABB'
        >>> apply_pipeline('aabbbbb') == 'ABBABBBBBBB'
        >>> apply_pipeline('abbab') == 'ABBBBABBB'
        >>> apply_pipeline('bbbbbabaa') == 'BBBBBABBBABBABB'
        >>> apply_pipeline('aabba') == 'ABBABBBBABB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aababa') == 'ABBABBBABBBABB'
    assert candidate('aba') == 'ABBBABB'
    assert candidate('ba') == 'BABB'
    assert candidate('aaaaaa') == 'ABBABBABBABBABBABB'
    assert candidate('aabbbbb') == 'ABBABBBBBBB'
    assert candidate('abbab') == 'ABBBBABBB'
    assert candidate('bbbbbabaa') == 'BBBBBABBBABBABB'
    assert candidate('aabba') == 'ABBABBBBABB'

    # hidden tests
    assert candidate('bbbbbba') == 'BBBBBBABB'
    assert candidate('abbbaaabb') == 'ABBBBBABBABBABBBB'
    assert candidate('baaaabbb') == 'BABBABBABBABBBBB'
    assert candidate('aaba') == 'ABBABBBABB'
    assert candidate('aba') == 'ABBBABB'
    assert candidate('abbaaaa') == 'ABBBBABBABBABBABB'
    assert candidate('b') == 'B'
    assert candidate('aababaab') == 'ABBABBBABBBABBABBB'
    assert candidate('bbbbba') == 'BBBBBABB'
    assert candidate('baaabbbbbb') == 'BABBABBABBBBBBBB'
    assert candidate('abbaaaa') == 'ABBBBABBABBABBABB'
    assert candidate('baab') == 'BABBABBB'
    assert candidate('bbbbaaa') == 'BBBBABBABBABB'
    assert candidate('bababbbabb') == 'BABBBABBBBBABBBB'
    assert candidate('b') == 'B'
    assert candidate('ababbb') == 'ABBBABBBBB'
    assert candidate('abbabaabab') == 'ABBBBABBBABBABBBABBB'
    assert candidate('baaaaaabba') == 'BABBABBABBABBABBABBBBABB'
    assert candidate('aab') == 'ABBABBB'
    assert candidate('aab') == 'ABBABBB'
    assert candidate('baaabb') == 'BABBABBABBBB'
    assert candidate('aa') == 'ABBABB'
    assert candidate('a') == 'ABB'
    assert candidate('abba') == 'ABBBBABB'
    assert candidate('babaa') == 'BABBBABBABB'
    assert candidate('baababab') == 'BABBABBBABBBABBB'
    assert candidate('abbbbb') == 'ABBBBBBB'
    assert candidate('babbaab') == 'BABBBBABBABBB'
    assert candidate('aaa') == 'ABBABBABB'
    assert candidate('a') == 'ABB'
    assert candidate('aba') == 'ABBBABB'
    assert candidate('abb') == 'ABBBB'

Input: aababa

Output: ABBABBBABBBABB

Input: aba

Output: ABBBABB

Input: ba

Output: BABB

Input: aaaaaa

Output: ABBABBABBABBABBABB

Input: aabbbbb

Output: ABBABBBBBBB

Input: abbab

Output: ABBBBABBB

Input: bbbbbabaa

Output: BBBBBABBBABBABB

Input: aabba

Output: ABBABBBBABB

Input: bbbbbba

Output: BBBBBBABB

Input: abbbaaabb

Output: ABBBBBABBABBABBBB

Input: baaaabbb

Output: BABBABBABBABBBBB

Input: aaba

Output: ABBABBBABB

Input: aba

Output: ABBBABB

Input: abbaaaa

Output: ABBBBABBABBABBABB

Input: b

Output: B

Input: aababaab

Output: ABBABBBABBBABBABBB

Input: bbbbba

Output: BBBBBABB

Input: baaabbbbbb

Output: BABBABBABBBBBBBB

Input: abbaaaa

Output: ABBBBABBABBABBABB

Input: baab

Output: BABBABBB

Input: bbbbaaa

Output: BBBBABBABBABB

Input: bababbbabb

Output: BABBBABBBBBABBBB

Input: b

Output: B

Input: ababbb

Output: ABBBABBBBB

Input: abbabaabab

Output: ABBBBABBBABBABBBABBB

Input: baaaaaabba

Output: BABBABBABBABBABBABBBBABB

Input: aab

Output: ABBABBB

Input: aab

Output: ABBABBB

Input: baaabb

Output: BABBABBABBBB

Input: aa

Output: ABBABB

Input: a

Output: ABB

Input: abba

Output: ABBBBABB

Input: babaa

Output: BABBBABBABB

Input: baababab

Output: BABBABBBABBBABBB

Input: abbbbb

Output: ABBBBBBB

Input: babbaab

Output: BABBBBABBABBB

Input: aaa

Output: ABBABBABB

Input: a

Output: ABB

Input: aba

Output: ABBBABB

Input: abb

Output: ABBBB


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('babbbaba') == 'babbbaba'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('baa') == 'baa'
        >>> apply_pipeline('bbb') == 'bbb'
        >>> apply_pipeline('ababbbabb') == 'ababbbabb'
        >>> apply_pipeline('babbba') == 'babbba'
        >>> apply_pipeline('aabbbba') == 'aabbbba'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('a') == 'a'
    assert candidate('babbbaba') == 'babbbaba'
    assert candidate('b') == 'b'
    assert candidate('baa') == 'baa'
    assert candidate('bbb') == 'bbb'
    assert candidate('ababbbabb') == 'ababbbabb'
    assert candidate('babbba') == 'babbba'
    assert candidate('aabbbba') == 'aabbbba'

    # hidden tests
    assert candidate('ab') == 'ab'
    assert candidate('bbba') == 'bbba'
    assert candidate('ab') == 'ab'
    assert candidate('bba') == 'bba'
    assert candidate('bbaba') == 'bbaba'
    assert candidate('bbbaabba') == 'bbbbba'
    assert candidate('aa') == 'aa'
    assert candidate('aabbba') == 'aabbba'
    assert candidate('aaa') == 'aaa'
    assert candidate('b') == 'b'
    assert candidate('abbab') == 'abbab'
    assert candidate('b') == 'b'
    assert candidate('abbaaaa') == 'abbaaaa'
    assert candidate('aababbbaba') == 'aababbbaba'
    assert candidate('aabaaaabaa') == 'aabaaaabaa'
    assert candidate('aba') == 'aba'
    assert candidate('babaababa') == 'babbaba'
    assert candidate('bbabbbbaa') == 'bbabbbbaa'
    assert candidate('bbaabab') == 'bbbab'
    assert candidate('aaa') == 'aaa'
    assert candidate('aaa') == 'aaa'
    assert candidate('a') == 'a'
    assert candidate('aabaaaa') == 'aabaaaa'
    assert candidate('b') == 'b'
    assert candidate('ba') == 'ba'
    assert candidate('aaabbbbb') == 'aaabbbbb'
    assert candidate('aaabbaab') == 'aaabbb'
    assert candidate('bbababba') == 'bbababba'
    assert candidate('a') == 'a'
    assert candidate('babababb') == 'babababb'
    assert candidate('bab') == 'bab'
    assert candidate('abbbababb') == 'abbbababb'

Input: a

Output: a

Input: babbbaba

Output: babbbaba

Input: b

Output: b

Input: baa

Output: baa

Input: bbb

Output: bbb

Input: ababbbabb

Output: ababbbabb

Input: babbba

Output: babbba

Input: aabbbba

Output: aabbbba

Input: ab

Output: ab

Input: bbba

Output: bbba

Input: ab

Output: ab

Input: bba

Output: bba

Input: bbaba

Output: bbaba

Input: bbbaabba

Output: bbbbba

Input: aa

Output: aa

Input: aabbba

Output: aabbba

Input: aaa

Output: aaa

Input: b

Output: b

Input: abbab

Output: abbab

Input: b

Output: b

Input: abbaaaa

Output: abbaaaa

Input: aababbbaba

Output: aababbbaba

Input: aabaaaabaa

Output: aabaaaabaa

Input: aba

Output: aba

Input: babaababa

Output: babbaba

Input: bbabbbbaa

Output: bbabbbbaa

Input: bbaabab

Output: bbbab

Input: aaa

Output: aaa

Input: aaa

Output: aaa

Input: a

Output: a

Input: aabaaaa

Output: aabaaaa

Input: b

Output: b

Input: ba

Output: ba

Input: aaabbbbb

Output: aaabbbbb

Input: aaabbaab

Output: aaabbb

Input: bbababba

Output: bbababba

Input: a

Output: a

Input: babababb

Output: babababb

Input: bab

Output: bab

Input: abbbababb

Output: abbbababb


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('abaa') == 'ABAA'
        >>> apply_pipeline('ab') == 'AB'
        >>> apply_pipeline('bababaa') == 'BABABAA'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('bbaa') == 'BBAA'
        >>> apply_pipeline('babaaabbbb') == 'BABAAABBBB'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('baaaabaab') == 'BAAAABAAB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abaa') == 'ABAA'
    assert candidate('ab') == 'AB'
    assert candidate('bababaa') == 'BABABAA'
    assert candidate('ba') == 'BA'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('babaaabbbb') == 'BABAAABBBB'
    assert candidate('ba') == 'BA'
    assert candidate('baaaabaab') == 'BAAAABAAB'

    # hidden tests
    assert candidate('baaaaab') == 'BAAAAAB'
    assert candidate('ba') == 'BA'
    assert candidate('babbaa') == 'BaaaaaA'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('ba') == 'BA'
    assert candidate('aaababbaaa') == 'AAABaaaaaAA'
    assert candidate('bbabbb') == 'BBABBB'
    assert candidate('aab') == 'AAB'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('abbbabbaa') == 'ABBBaaaaaA'
    assert candidate('aababbbabb') == 'AABABBBABB'
    assert candidate('abbaababa') == 'aaaaaABABA'
    assert candidate('babbab') == 'BaaaaaB'
    assert candidate('a') == 'A'
    assert candidate('abaabbba') == 'ABAABBBA'
    assert candidate('aaaabaabba') == 'AAAABAaaaaa'
    assert candidate('abbabbaab') == 'aaaaaBBAAB'
    assert candidate('abba') == 'aaaaa'
    assert candidate('aab') == 'AAB'
    assert candidate('babbbaaaba') == 'BABBBAAABA'
    assert candidate('baabba') == 'BAaaaaa'
    assert candidate('abbbabbb') == 'ABBBABBB'
    assert candidate('a') == 'A'
    assert candidate('abbabaa') == 'aaaaaBAA'
    assert candidate('bb') == 'BB'
    assert candidate('bbbaa') == 'BBBAA'
    assert candidate('ba') == 'BA'
    assert candidate('abbababab') == 'aaaaaBABAB'
    assert candidate('b') == 'B'
    assert candidate('aaab') == 'AAAB'
    assert candidate('bbab') == 'BBAB'

Input: abaa

Output: ABAA

Input: ab

Output: AB

Input: bababaa

Output: BABABAA

Input: ba

Output: BA

Input: bbaa

Output: BBAA

Input: babaaabbbb

Output: BABAAABBBB

Input: ba

Output: BA

Input: baaaabaab

Output: BAAAABAAB

Input: baaaaab

Output: BAAAAAB

Input: ba

Output: BA

Input: babbaa

Output: BaaaaaA

Input: a

Output: A

Input: a

Output: A

Input: ba

Output: BA

Input: aaababbaaa

Output: AAABaaaaaAA

Input: bbabbb

Output: BBABBB

Input: aab

Output: AAB

Input: baaab

Output: BAAAB

Input: abbbabbaa

Output: ABBBaaaaaA

Input: aababbbabb

Output: AABABBBABB

Input: abbaababa

Output: aaaaaABABA

Input: babbab

Output: BaaaaaB

Input: a

Output: A

Input: abaabbba

Output: ABAABBBA

Input: aaaabaabba

Output: AAAABAaaaaa

Input: abbabbaab

Output: aaaaaBBAAB

Input: abba

Output: aaaaa

Input: aab

Output: AAB

Input: babbbaaaba

Output: BABBBAAABA

Input: baabba

Output: BAaaaaa

Input: abbbabbb

Output: ABBBABBB

Input: a

Output: A

Input: abbabaa

Output: aaaaaBAA

Input: bb

Output: BB

Input: bbbaa

Output: BBBAA

Input: ba

Output: BA

Input: abbababab

Output: aaaaaBABAB

Input: b

Output: B

Input: aaab

Output: AAAB

Input: bbab

Output: BBAB


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('bbbbaaba') == 'abbaabbbaabbbaabaaabbaabbbaabaaaaabbaabbbaaba'
        >>> apply_pipeline('baaabaabab') == 'aaabbaabbbaabaaaaaabbaabbbaabaaaaabbaabbbaababbaab'
        >>> apply_pipeline('abaaaabb') == 'aaaabbaabbbaabaaaaabbaabbbaab'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('ababa') == 'aaaabbaabbbaabaaaabbaabbbaaba'
        >>> apply_pipeline('bbabaabb') == 'bbaabaaabbaabbbaabaaaabbaabbbaabaaabbaabbbaab'
        >>> apply_pipeline('bbbbaba') == 'abbaabbbaabbbaabaaabbaabbbaabaaaabbaabbbaaba'
        >>> apply_pipeline('bb') == 'abbaabbbaab'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbbbaaba') == 'abbaabbbaabbbaabaaabbaabbbaabaaaaabbaabbbaaba'
    assert candidate('baaabaabab') == 'aaabbaabbbaabaaaaaabbaabbbaabaaaaabbaabbbaababbaab'
    assert candidate('abaaaabb') == 'aaaabbaabbbaabaaaaabbaabbbaab'
    assert candidate('a') == 'a'
    assert candidate('ababa') == 'aaaabbaabbbaabaaaabbaabbbaaba'
    assert candidate('bbabaabb') == 'bbaabaaabbaabbbaabaaaabbaabbbaabaaabbaabbbaab'
    assert candidate('bbbbaba') == 'abbaabbbaabbbaabaaabbaabbbaabaaaabbaabbbaaba'
    assert candidate('bb') == 'abbaabbbaab'

    # hidden tests
    assert candidate('aabbaaa') == 'aabbaabaaabbaabbbaabaaa'
    assert candidate('aaabbbaa') == 'aaaabbaabbbaabaaabbaabbbaabaa'
    assert candidate('ba') == 'aaabbaabbbaaba'
    assert candidate('aa') == 'aa'
    assert candidate('baaabababa') == 'aaabbaabbbaabaaaaaabbaabbbaabaaaabbaabbbaabaaaabbaabbbaaba'
    assert candidate('abbaab') == 'abbaabaaabbaabbbaabaabbaab'
    assert candidate('aababba') == 'aaaaabbaabbbaababbaabaaabbaabbbaaba'
    assert candidate('bbbbaaba') == 'abbaabbbaabbbaabaaabbaabbbaabaaaaabbaabbbaaba'
    assert candidate('baabaab') == 'aaabbaabbbaabaaaaabbaabbbaabaabbaab'
    assert candidate('baaababb') == 'aaabbaabbbaabaaaaaabbaabbbaabaabbaabbbaab'
    assert candidate('aa') == 'aa'
    assert candidate('baaa') == 'aaabbaabbbaabaaa'
    assert candidate('baabba') == 'aaabbaabbbaabaabbaabaaabbaabbbaaba'
    assert candidate('abaaaaaa') == 'aaaabbaabbbaabaaaaaa'
    assert candidate('b') == 'bbaab'
    assert candidate('ab') == 'abbaab'
    assert candidate('babb') == 'aaabbaabbbaabaabbaabbbaab'
    assert candidate('bbaaababb') == 'bbaabaaabbaabbbaabaaaaaabbaabbbaabaabbaabbbaab'
    assert candidate('aabaa') == 'aaaaabbaabbbaabaa'
    assert candidate('baabbba') == 'aaabbaabbbaabaaabbaabbbaabaaabbaabbbaaba'
    assert candidate('baba') == 'aaabbaabbbaabaaaabbaabbbaaba'
    assert candidate('baabbaa') == 'aaabbaabbbaabaabbaabaaabbaabbbaabaa'
    assert candidate('aa') == 'aa'
    assert candidate('ba') == 'aaabbaabbbaaba'
    assert candidate('ab') == 'abbaab'
    assert candidate('babbbabaa') == 'aaabbaabbbaabaabbaabbbaabaaabbaabbbaabaaaabbaabbbaabaa'
    assert candidate('ab') == 'abbaab'
    assert candidate('abababb') == 'aaaabbaabbbaabaaaabbaabbbaabaabbaabbbaab'
    assert candidate('abbabba') == 'abbaabaaabbaabbbaababbaabaaabbaabbbaaba'
    assert candidate('aababaa') == 'aaaaabbaabbbaabaaaabbaabbbaabaa'
    assert candidate('aab') == 'aabbaab'
    assert candidate('aabbab') == 'aabbaabaaabbaabbbaababbaab'

Input: bbbbaaba

Output: abbaabbbaabbbaabaaabbaabbbaabaaaaabbaabbbaaba

Input: baaabaabab

Output: aaabbaabbbaabaaaaaabbaabbbaabaaaaabbaabbbaababbaab

Input: abaaaabb

Output: aaaabbaabbbaabaaaaabbaabbbaab

Input: a

Output: a

Input: ababa

Output: aaaabbaabbbaabaaaabbaabbbaaba

Input: bbabaabb

Output: bbaabaaabbaabbbaabaaaabbaabbbaabaaabbaabbbaab

Input: bbbbaba

Output: abbaabbbaabbbaabaaabbaabbbaabaaaabbaabbbaaba

Input: bb

Output: abbaabbbaab

Input: aabbaaa

Output: aabbaabaaabbaabbbaabaaa

Input: aaabbbaa

Output: aaaabbaabbbaabaaabbaabbbaabaa

Input: ba

Output: aaabbaabbbaaba

Input: aa

Output: aa

Input: baaabababa

Output: aaabbaabbbaabaaaaaabbaabbbaabaaaabbaabbbaabaaaabbaabbbaaba

Input: abbaab

Output: abbaabaaabbaabbbaabaabbaab

Input: aababba

Output: aaaaabbaabbbaababbaabaaabbaabbbaaba

Input: bbbbaaba

Output: abbaabbbaabbbaabaaabbaabbbaabaaaaabbaabbbaaba

Input: baabaab

Output: aaabbaabbbaabaaaaabbaabbbaabaabbaab

Input: baaababb

Output: aaabbaabbbaabaaaaaabbaabbbaabaabbaabbbaab

Input: aa

Output: aa

Input: baaa

Output: aaabbaabbbaabaaa

Input: baabba

Output: aaabbaabbbaabaabbaabaaabbaabbbaaba

Input: abaaaaaa

Output: aaaabbaabbbaabaaaaaa

Input: b

Output: bbaab

Input: ab

Output: abbaab

Input: babb

Output: aaabbaabbbaabaabbaabbbaab

Input: bbaaababb

Output: bbaabaaabbaabbbaabaaaaaabbaabbbaabaabbaabbbaab

Input: aabaa

Output: aaaaabbaabbbaabaa

Input: baabbba

Output: aaabbaabbbaabaaabbaabbbaabaaabbaabbbaaba

Input: baba

Output: aaabbaabbbaabaaaabbaabbbaaba

Input: baabbaa

Output: aaabbaabbbaabaabbaabaaabbaabbbaabaa

Input: aa

Output: aa

Input: ba

Output: aaabbaabbbaaba

Input: ab

Output: abbaab

Input: babbbabaa

Output: aaabbaabbbaabaabbaabbbaabaaabbaabbbaabaaaabbaabbbaabaa

Input: ab

Output: abbaab

Input: abababb

Output: aaaabbaabbbaabaaaabbaabbbaabaabbaabbbaab

Input: abbabba

Output: abbaabaaabbaabbbaababbaabaaabbaabbbaaba

Input: aababaa

Output: aaaaabbaabbbaabaaaabbaabbbaabaa

Input: aab

Output: aabbaab

Input: aabbab

Output: aabbaabaaabbaabbbaababbaab


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('babbaaaaa') == 'BABBABABBA'
        >>> apply_pipeline('ab') == 'AB'
        >>> apply_pipeline('baabaaba') == 'BAABAABA'
        >>> apply_pipeline('baaaabaabb') == 'BABABBBAABB'
        >>> apply_pipeline('babbaabbb') == 'BABBAABBB'
        >>> apply_pipeline('abaababbab') == 'ABAABABBAB'
        >>> apply_pipeline('bbabbaab') == 'BBABBAAB'
        >>> apply_pipeline('babbbb') == 'BABBBB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babbaaaaa') == 'BABBABABBA'
    assert candidate('ab') == 'AB'
    assert candidate('baabaaba') == 'BAABAABA'
    assert candidate('baaaabaabb') == 'BABABBBAABB'
    assert candidate('babbaabbb') == 'BABBAABBB'
    assert candidate('abaababbab') == 'ABAABABBAB'
    assert candidate('bbabbaab') == 'BBABBAAB'
    assert candidate('babbbb') == 'BABBBB'

    # hidden tests
    assert candidate('aba') == 'ABA'
    assert candidate('bb') == 'BB'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('baaaa') == 'BABABB'
    assert candidate('abb') == 'ABB'
    assert candidate('aa') == 'AA'
    assert candidate('bbaaba') == 'BBAABA'
    assert candidate('bb') == 'BB'
    assert candidate('bbbab') == 'BBBAB'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('aaababb') == 'BAABB'
    assert candidate('aaaa') == 'ABABB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aaba') == 'AABA'
    assert candidate('b') == 'B'
    assert candidate('a') == 'A'
    assert candidate('abbbaabba') == 'ABBBAABBA'
    assert candidate('abbabaabb') == 'ABBABAABB'
    assert candidate('bbbbbaba') == 'BBBBBABA'
    assert candidate('abaabbaaba') == 'ABAABBAABA'
    assert candidate('ababaabaa') == 'ABABAABAA'
    assert candidate('aaabaaaa') == 'BAABABB'
    assert candidate('aabbaba') == 'AABBABA'
    assert candidate('aaabbaabb') == 'AAABBAABB'
    assert candidate('babbb') == 'BABBB'
    assert candidate('abba') == 'ABBA'
    assert candidate('b') == 'B'
    assert candidate('bbaab') == 'BBAAB'
    assert candidate('baaabaaaba') == 'BBAAAABA'
    assert candidate('bbaabbaaaa') == 'BBAABBABABB'

Input: babbaaaaa

Output: BABBABABBA

Input: ab

Output: AB

Input: baabaaba

Output: BAABAABA

Input: baaaabaabb

Output: BABABBBAABB

Input: babbaabbb

Output: BABBAABBB

Input: abaababbab

Output: ABAABABBAB

Input: bbabbaab

Output: BBABBAAB

Input: babbbb

Output: BABBBB

Input: aba

Output: ABA

Input: bb

Output: BB

Input: a

Output: A

Input: a

Output: A

Input: a

Output: A

Input: baaaa

Output: BABABB

Input: abb

Output: ABB

Input: aa

Output: AA

Input: bbaaba

Output: BBAABA

Input: bb

Output: BB

Input: bbbab

Output: BBBAB

Input: bbbb

Output: BBBB

Input: aaababb

Output: BAABB

Input: aaaa

Output: ABABB

Input: aaa

Output: AAA

Input: aaba

Output: AABA

Input: b

Output: B

Input: a

Output: A

Input: abbbaabba

Output: ABBBAABBA

Input: abbabaabb

Output: ABBABAABB

Input: bbbbbaba

Output: BBBBBABA

Input: abaabbaaba

Output: ABAABBAABA

Input: ababaabaa

Output: ABABAABAA

Input: aaabaaaa

Output: BAABABB

Input: aabbaba

Output: AABBABA

Input: aaabbaabb

Output: AAABBAABB

Input: babbb

Output: BABBB

Input: abba

Output: ABBA

Input: b

Output: B

Input: bbaab

Output: BBAAB

Input: baaabaaaba

Output: BBAAAABA

Input: bbaabbaaaa

Output: BBAABBABABB


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('abbaaaba') == 'ABBAAABA'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('baababbaaa') == 'BABABBAAAA'
        >>> apply_pipeline('aaaaaabb') == 'AAAAAABB'
        >>> apply_pipeline('aaaabbbbb') == 'AAAABBBBB'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('aabaaaba') == 'AABAAABA'
        >>> apply_pipeline('ba') == 'BA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.replace('ABAB', 'babb')
    s = s.replace('bBA', 'baa')
    s = s.upper()
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbaaaba') == 'ABBAAABA'
    assert candidate('ba') == 'BA'
    assert candidate('baababbaaa') == 'BABABBAAAA'
    assert candidate('aaaaaabb') == 'AAAAAABB'
    assert candidate('aaaabbbbb') == 'AAAABBBBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aabaaaba') == 'AABAAABA'
    assert candidate('ba') == 'BA'

    # hidden tests
    assert candidate('aaabbaa') == 'AAABBAA'
    assert candidate('aababaaabb') == 'ABABBAAABB'
    assert candidate('aa') == 'AA'
    assert candidate('abaabbbb') == 'ABAABBBB'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('a') == 'A'
    assert candidate('babbbbbbba') == 'BABBBBBBBA'
    assert candidate('aaba') == 'AABA'
    assert candidate('babb') == 'BABB'
    assert candidate('bbaabaa') == 'BBAABAA'
    assert candidate('baa') == 'BAA'
    assert candidate('b') == 'B'
    assert candidate('bbabbaa') == 'BBABBAA'
    assert candidate('ab') == 'AB'
    assert candidate('bbabaabaab') == 'BBABAABAAB'
    assert candidate('abaabaabab') == 'ABAABABABB'
    assert candidate('bbbaaabbab') == 'BBBAAABBAB'
    assert candidate('babbaaa') == 'BABBAAA'
    assert candidate('babbbaaa') == 'BABBBAAA'
    assert candidate('baabab') == 'BABABB'
    assert candidate('a') == 'A'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('abaaabaa') == 'ABAAABAA'
    assert candidate('b') == 'B'
    assert candidate('aa') == 'AA'
    assert candidate('baaaba') == 'BAAABA'
    assert candidate('baabbbaaa') == 'BAABBBAAA'
    assert candidate('babbbaaa') == 'BABBBAAA'
    assert candidate('b') == 'B'
    assert candidate('abbbbaaab') == 'ABBBBAAAB'
    assert candidate('abbaaabbab') == 'ABBAAABBAB'
    assert candidate('abbbababa') == 'ABBBBABBA'

Input: abbaaaba

Output: ABBAAABA

Input: ba

Output: BA

Input: baababbaaa

Output: BABABBAAAA

Input: aaaaaabb

Output: AAAAAABB

Input: aaaabbbbb

Output: AAAABBBBB

Input: aaa

Output: AAA

Input: aabaaaba

Output: AABAAABA

Input: ba

Output: BA

Input: aaabbaa

Output: AAABBAA

Input: aababaaabb

Output: ABABBAAABB

Input: aa

Output: AA

Input: abaabbbb

Output: ABAABBBB

Input: abaaa

Output: ABAAA

Input: a

Output: A

Input: babbbbbbba

Output: BABBBBBBBA

Input: aaba

Output: AABA

Input: babb

Output: BABB

Input: bbaabaa

Output: BBAABAA

Input: baa

Output: BAA

Input: b

Output: B

Input: bbabbaa

Output: BBABBAA

Input: ab

Output: AB

Input: bbabaabaab

Output: BBABAABAAB

Input: abaabaabab

Output: ABAABABABB

Input: bbbaaabbab

Output: BBBAAABBAB

Input: babbaaa

Output: BABBAAA

Input: babbbaaa

Output: BABBBAAA

Input: baabab

Output: BABABB

Input: a

Output: A

Input: abaaa

Output: ABAAA

Input: abaaabaa

Output: ABAAABAA

Input: b

Output: B

Input: aa

Output: AA

Input: baaaba

Output: BAAABA

Input: baabbbaaa

Output: BAABBBAAA

Input: babbbaaa

Output: BABBBAAA

Input: b

Output: B

Input: abbbbaaab

Output: ABBBBAAAB

Input: abbaaabbab

Output: ABBAAABBAB

Input: abbbababa

Output: ABBBBABBA


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('bbabb') == 'bbabb'
        >>> apply_pipeline('bbaba') == 'bbaba'
        >>> apply_pipeline('babbabaabb') == 'babbabaabb'
        >>> apply_pipeline('aabbababaa') == 'aabbababaa'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('bba') == 'bba'
        >>> apply_pipeline('ab') == 'ab'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbabb') == 'bbabb'
    assert candidate('bbaba') == 'bbaba'
    assert candidate('babbabaabb') == 'babbabaabb'
    assert candidate('aabbababaa') == 'aabbababaa'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('bba') == 'bba'
    assert candidate('ab') == 'ab'

    # hidden tests
    assert candidate('bbb') == 'bbb'
    assert candidate('a') == 'a'
    assert candidate('bbaaaba') == 'bbaaaba'
    assert candidate('aaa') == 'aaa'
    assert candidate('abbbb') == 'abbbb'
    assert candidate('babab') == 'babab'
    assert candidate('a') == 'a'
    assert candidate('ab') == 'ab'
    assert candidate('ab') == 'ab'
    assert candidate('bbaaaabbb') == 'bbaaaabbb'
    assert candidate('aaaabbab') == 'aaaabbab'
    assert candidate('abbabaaa') == 'abbabaaa'
    assert candidate('aab') == 'aab'
    assert candidate('bbab') == 'bbab'
    assert candidate('babbab') == 'babbab'
    assert candidate('abaaa') == 'abaaa'
    assert candidate('bbbbaabbb') == 'bbbbaabbb'
    assert candidate('bbbaaa') == 'bbbaaa'
    assert candidate('aa') == 'aa'
    assert candidate('bbb') == 'bbb'
    assert candidate('abbbaababa') == 'abbbaababa'
    assert candidate('a') == 'a'
    assert candidate('baabbaaab') == 'baabbaaab'
    assert candidate('abba') == 'abba'
    assert candidate('b') == 'b'
    assert candidate('ababababaa') == 'ababababaa'
    assert candidate('ab') == 'ab'
    assert candidate('bbabbabb') == 'bbabbabb'
    assert candidate('bbbba') == 'bbbba'
    assert candidate('abababaab') == 'abababaab'
    assert candidate('aabb') == 'aabb'
    assert candidate('bbaabbbab') == 'bbaabbbab'

Input: bbabb

Output: bbabb

Input: bbaba

Output: bbaba

Input: babbabaabb

Output: babbabaabb

Input: aabbababaa

Output: aabbababaa

Input: b

Output: b

Input: b

Output: b

Input: bba

Output: bba

Input: ab

Output: ab

Input: bbb

Output: bbb

Input: a

Output: a

Input: bbaaaba

Output: bbaaaba

Input: aaa

Output: aaa

Input: abbbb

Output: abbbb

Input: babab

Output: babab

Input: a

Output: a

Input: ab

Output: ab

Input: ab

Output: ab

Input: bbaaaabbb

Output: bbaaaabbb

Input: aaaabbab

Output: aaaabbab

Input: abbabaaa

Output: abbabaaa

Input: aab

Output: aab

Input: bbab

Output: bbab

Input: babbab

Output: babbab

Input: abaaa

Output: abaaa

Input: bbbbaabbb

Output: bbbbaabbb

Input: bbbaaa

Output: bbbaaa

Input: aa

Output: aa

Input: bbb

Output: bbb

Input: abbbaababa

Output: abbbaababa

Input: a

Output: a

Input: baabbaaab

Output: baabbaaab

Input: abba

Output: abba

Input: b

Output: b

Input: ababababaa

Output: ababababaa

Input: ab

Output: ab

Input: bbabbabb

Output: bbabbabb

Input: bbbba

Output: bbbba

Input: abababaab

Output: abababaab

Input: aabb

Output: aabb

Input: bbaabbbab

Output: bbaabbbab


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('ababbabbab') == 'ababbabbab'
        >>> apply_pipeline('abaabbbba') == 'abaabbbba'
        >>> apply_pipeline('bbbab') == 'bbbab'
        >>> apply_pipeline('bbbb') == 'bbbb'
        >>> apply_pipeline('baababb') == 'baababb'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('aaaabababb') == 'aaaabababb'
        >>> apply_pipeline('abbab') == 'abbab'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('ababbabbab') == 'ababbabbab'
    assert candidate('abaabbbba') == 'abaabbbba'
    assert candidate('bbbab') == 'bbbab'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('baababb') == 'baababb'
    assert candidate('a') == 'a'
    assert candidate('aaaabababb') == 'aaaabababb'
    assert candidate('abbab') == 'abbab'

    # hidden tests
    assert candidate('a') == 'a'
    assert candidate('a') == 'a'
    assert candidate('abbbaba') == 'abbbaba'
    assert candidate('abba') == 'abba'
    assert candidate('abbaaabaa') == 'abbaaabaa'
    assert candidate('baaab') == 'baaab'
    assert candidate('bb') == 'bb'
    assert candidate('b') == 'b'
    assert candidate('ab') == 'ab'
    assert candidate('aaabaabaa') == 'aaabaabaa'
    assert candidate('abaaba') == 'abaaba'
    assert candidate('aaaaabab') == 'aaaaabab'
    assert candidate('baabbabbba') == 'baabbabbba'
    assert candidate('bba') == 'bba'
    assert candidate('babbbab') == 'babbbab'
    assert candidate('ab') == 'ab'
    assert candidate('baaa') == 'baaa'
    assert candidate('b') == 'b'
    assert candidate('aabbaa') == 'aabbaa'
    assert candidate('bb') == 'bb'
    assert candidate('bbba') == 'bbba'
    assert candidate('ababbb') == 'ababbb'
    assert candidate('b') == 'b'
    assert candidate('aabbabab') == 'aabbabab'
    assert candidate('bbba') == 'bbba'
    assert candidate('abbabbbab') == 'abbabbbab'
    assert candidate('bbbabb') == 'bbbabb'
    assert candidate('aaa') == 'aaa'
    assert candidate('abbaabbaaa') == 'abbaabbaaa'
    assert candidate('aa') == 'aa'
    assert candidate('baaabbbb') == 'baaabbbb'
    assert candidate('a') == 'a'

Input: ababbabbab

Output: ababbabbab

Input: abaabbbba

Output: abaabbbba

Input: bbbab

Output: bbbab

Input: bbbb

Output: bbbb

Input: baababb

Output: baababb

Input: a

Output: a

Input: aaaabababb

Output: aaaabababb

Input: abbab

Output: abbab

Input: a

Output: a

Input: a

Output: a

Input: abbbaba

Output: abbbaba

Input: abba

Output: abba

Input: abbaaabaa

Output: abbaaabaa

Input: baaab

Output: baaab

Input: bb

Output: bb

Input: b

Output: b

Input: ab

Output: ab

Input: aaabaabaa

Output: aaabaabaa

Input: abaaba

Output: abaaba

Input: aaaaabab

Output: aaaaabab

Input: baabbabbba

Output: baabbabbba

Input: bba

Output: bba

Input: babbbab

Output: babbbab

Input: ab

Output: ab

Input: baaa

Output: baaa

Input: b

Output: b

Input: aabbaa

Output: aabbaa

Input: bb

Output: bb

Input: bbba

Output: bbba

Input: ababbb

Output: ababbb

Input: b

Output: b

Input: aabbabab

Output: aabbabab

Input: bbba

Output: bbba

Input: abbabbbab

Output: abbabbbab

Input: bbbabb

Output: bbbabb

Input: aaa

Output: aaa

Input: abbaabbaaa

Output: abbaabbaaa

Input: aa

Output: aa

Input: baaabbbb

Output: baaabbbb

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('a') == 'A'
        >>> apply_pipeline('baabbbb') == 'BAABBBB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('babaaaa') == 'BABAAAA'
        >>> apply_pipeline('b') == 'B'
    """
    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('a') == 'A'
    assert candidate('baabbbb') == 'BAABBBB'
    assert candidate('b') == 'B'
    assert candidate('aaa') == 'AAA'
    assert candidate('a') == 'A'
    assert candidate('aa') == 'AA'
    assert candidate('babaaaa') == 'BABAAAA'
    assert candidate('b') == 'B'

    # hidden tests
    assert candidate('abaaba') == 'ABAABA'
    assert candidate('bbabbbaab') == 'BBABBBAAB'
    assert candidate('aababaaba') == 'AABABAABA'
    assert candidate('babbbaaaa') == 'BABBBAAAA'
    assert candidate('aaaaabaa') == 'AAAAABAA'
    assert candidate('aab') == 'AAB'
    assert candidate('bb') == 'BB'
    assert candidate('baaaabba') == 'BAAAABBA'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('a') == 'A'
    assert candidate('b') == 'B'
    assert candidate('aaa') == 'AAA'
    assert candidate('bbaaabaa') == 'BBAAABAA'
    assert candidate('abb') == 'ABB'
    assert candidate('b') == 'B'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('abbbbbaaaa') == 'ABBBBBAAAA'
    assert candidate('a') == 'A'
    assert candidate('ababbbaaaa') == 'ABABBBAAAA'
    assert candidate('b') == 'B'
    assert candidate('babb') == 'BABB'
    assert candidate('aaa') == 'AAA'
    assert candidate('bb') == 'BB'
    assert candidate('a') == 'A'
    assert candidate('bbbbba') == 'BBBBBA'
    assert candidate('abaabbb') == 'ABAABBB'
    assert candidate('b') == 'B'
    assert candidate('bbbabbbaba') == 'BBBABBBABA'
    assert candidate('bbab') == 'BBAB'
    assert candidate('babaaababa') == 'BABAAABABA'
    assert candidate('ba') == 'BA'

Input: a

Output: A

Input: baabbbb

Output: BAABBBB

Input: b

Output: B

Input: aaa

Output: AAA

Input: a

Output: A

Input: aa

Output: AA

Input: babaaaa

Output: BABAAAA

Input: b

Output: B

Input: abaaba

Output: ABAABA

Input: bbabbbaab

Output: BBABBBAAB

Input: aababaaba

Output: AABABAABA

Input: babbbaaaa

Output: BABBBAAAA

Input: aaaaabaa

Output: AAAAABAA

Input: aab

Output: AAB

Input: bb

Output: BB

Input: baaaabba

Output: BAAAABBA

Input: a

Output: A

Input: a

Output: A

Input: a

Output: A

Input: b

Output: B

Input: aaa

Output: AAA

Input: bbaaabaa

Output: BBAAABAA

Input: abb

Output: ABB

Input: b

Output: B

Input: baaab

Output: BAAAB

Input: abbbbbaaaa

Output: ABBBBBAAAA

Input: a

Output: A

Input: ababbbaaaa

Output: ABABBBAAAA

Input: b

Output: B

Input: babb

Output: BABB

Input: aaa

Output: AAA

Input: bb

Output: BB

Input: a

Output: A

Input: bbbbba

Output: BBBBBA

Input: abaabbb

Output: ABAABBB

Input: b

Output: B

Input: bbbabbbaba

Output: BBBABBBABA

Input: bbab

Output: BBAB

Input: babaaababa

Output: BABAAABABA

Input: ba

Output: BA


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('aabab') == 'aabab'
        >>> apply_pipeline('babbbb') == 'babbbb'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('ab') == 'ab'
        >>> apply_pipeline('babb') == 'babb'
        >>> apply_pipeline('bbabbb') == 'bbabbb'
        >>> apply_pipeline('aaaba') == 'aaaba'
        >>> apply_pipeline('baababab') == 'baababab'
    """
    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('aabab') == 'aabab'
    assert candidate('babbbb') == 'babbbb'
    assert candidate('a') == 'a'
    assert candidate('ab') == 'ab'
    assert candidate('babb') == 'babb'
    assert candidate('bbabbb') == 'bbabbb'
    assert candidate('aaaba') == 'aaaba'
    assert candidate('baababab') == 'baababab'

    # hidden tests
    assert candidate('aabbbabaa') == 'aabbbabaa'
    assert candidate('bbab') == 'bbab'
    assert candidate('b') == 'b'
    assert candidate('aabaabb') == 'aabaabb'
    assert candidate('aa') == 'aa'
    assert candidate('aaabaab') == 'aaabaab'
    assert candidate('ba') == 'ba'
    assert candidate('aabbbbbba') == 'aabbbbbba'
    assert candidate('bbaaaa') == 'bbaaaa'
    assert candidate('aaa') == 'aaa'
    assert candidate('bb') == 'bb'
    assert candidate('baa') == 'baa'
    assert candidate('bba') == 'bba'
    assert candidate('abababa') == 'abababa'
    assert candidate('aaaabbbb') == 'aaaabbbb'
    assert candidate('aa') == 'aa'
    assert candidate('bababaaa') == 'bababaaa'
    assert candidate('baba') == 'baba'
    assert candidate('bbabbbabb') == 'bbabbbabb'
    assert candidate('abbbaaab') == 'abbbaaab'
    assert candidate('bb') == 'bb'
    assert candidate('ab') == 'ab'
    assert candidate('bbaaba') == 'bbaaba'
    assert candidate('bbbbaabaaa') == 'bbbbaabaaa'
    assert candidate('abaaa') == 'abaaa'
    assert candidate('baaaabaaab') == 'baaaabaaab'
    assert candidate('bbbbabaaab') == 'bbbbabaaab'
    assert candidate('baaaabba') == 'baaaabba'
    assert candidate('bbbbaaba') == 'bbbbaaba'
    assert candidate('ab') == 'ab'
    assert candidate('baabaa') == 'baabaa'
    assert candidate('aa') == 'aa'

Input: aabab

Output: aabab

Input: babbbb

Output: babbbb

Input: a

Output: a

Input: ab

Output: ab

Input: babb

Output: babb

Input: bbabbb

Output: bbabbb

Input: aaaba

Output: aaaba

Input: baababab

Output: baababab

Input: aabbbabaa

Output: aabbbabaa

Input: bbab

Output: bbab

Input: b

Output: b

Input: aabaabb

Output: aabaabb

Input: aa

Output: aa

Input: aaabaab

Output: aaabaab

Input: ba

Output: ba

Input: aabbbbbba

Output: aabbbbbba

Input: bbaaaa

Output: bbaaaa

Input: aaa

Output: aaa

Input: bb

Output: bb

Input: baa

Output: baa

Input: bba

Output: bba

Input: abababa

Output: abababa

Input: aaaabbbb

Output: aaaabbbb

Input: aa

Output: aa

Input: bababaaa

Output: bababaaa

Input: baba

Output: baba

Input: bbabbbabb

Output: bbabbbabb

Input: abbbaaab

Output: abbbaaab

Input: bb

Output: bb

Input: ab

Output: ab

Input: bbaaba

Output: bbaaba

Input: bbbbaabaaa

Output: bbbbaabaaa

Input: abaaa

Output: abaaa

Input: baaaabaaab

Output: baaaabaaab

Input: bbbbabaaab

Output: bbbbabaaab

Input: baaaabba

Output: baaaabba

Input: bbbbaaba

Output: bbbbaaba

Input: ab

Output: ab

Input: baabaa

Output: baabaa

Input: aa

Output: aa


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('bbbb') == 'bbbb'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('ba') == 'ba'
        >>> apply_pipeline('baa') == 'baa'
        >>> apply_pipeline('babba') == 'babba'
        >>> apply_pipeline('babaab') == 'babaab'
        >>> apply_pipeline('aaabba') == 'aaabba'
        >>> apply_pipeline('aab') == 'aab'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbbb') == 'bbbb'
    assert candidate('b') == 'b'
    assert candidate('ba') == 'ba'
    assert candidate('baa') == 'baa'
    assert candidate('babba') == 'babba'
    assert candidate('babaab') == 'babaab'
    assert candidate('aaabba') == 'aaabba'
    assert candidate('aab') == 'aab'

    # hidden tests
    assert candidate('aababbaaa') == 'aababbaaa'
    assert candidate('bbabbaab') == 'bbabbaab'
    assert candidate('baaa') == 'baaa'
    assert candidate('baaabbbba') == 'baaabbbba'
    assert candidate('baaaaaaa') == 'baaaaaaa'
    assert candidate('aab') == 'aab'
    assert candidate('aaaaaaa') == 'aaaaaaa'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('ab') == 'ab'
    assert candidate('babbabbb') == 'babbabbb'
    assert candidate('aabb') == 'aabb'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('bbaaaabaaa') == 'bbaaaabaaa'
    assert candidate('bbaaabaaa') == 'bbaaabaaa'
    assert candidate('ababb') == 'ababb'
    assert candidate('babbb') == 'babbb'
    assert candidate('baaba') == 'baaba'
    assert candidate('bababab') == 'bababab'
    assert candidate('aaababbbb') == 'aaababbbb'
    assert candidate('aabaa') == 'aabaa'
    assert candidate('aaaaaaaa') == 'aaaaaaaa'
    assert candidate('baabbaaba') == 'baabbaaba'
    assert candidate('baaababb') == 'baaababb'
    assert candidate('bab') == 'bab'
    assert candidate('aa') == 'aa'
    assert candidate('bbb') == 'bbb'
    assert candidate('abaa') == 'abaa'
    assert candidate('b') == 'b'
    assert candidate('aaaba') == 'aaaba'
    assert candidate('bbbaaaa') == 'bbbaaaa'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('b') == 'b'

Input: bbbb

Output: bbbb

Input: b

Output: b

Input: ba

Output: ba

Input: baa

Output: baa

Input: babba

Output: babba

Input: babaab

Output: babaab

Input: aaabba

Output: aaabba

Input: aab

Output: aab

Input: aababbaaa

Output: aababbaaa

Input: bbabbaab

Output: bbabbaab

Input: baaa

Output: baaa

Input: baaabbbba

Output: baaabbbba

Input: baaaaaaa

Output: baaaaaaa

Input: aab

Output: aab

Input: aaaaaaa

Output: aaaaaaa

Input: bbbb

Output: bbbb

Input: ab

Output: ab

Input: babbabbb

Output: babbabbb

Input: aabb

Output: aabb

Input: aaaa

Output: aaaa

Input: bbaaaabaaa

Output: bbaaaabaaa

Input: bbaaabaaa

Output: bbaaabaaa

Input: ababb

Output: ababb

Input: babbb

Output: babbb

Input: baaba

Output: baaba

Input: bababab

Output: bababab

Input: aaababbbb

Output: aaababbbb

Input: aabaa

Output: aabaa

Input: aaaaaaaa

Output: aaaaaaaa

Input: baabbaaba

Output: baabbaaba

Input: baaababb

Output: baaababb

Input: bab

Output: bab

Input: aa

Output: aa

Input: bbb

Output: bbb

Input: abaa

Output: abaa

Input: b

Output: b

Input: aaaba

Output: aaaba

Input: bbbaaaa

Output: bbbaaaa

Input: bbbb

Output: bbbb

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('aab') == 'ABAAbaabaabbAB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('a') == 'ABAAA'
        >>> apply_pipeline('aaabbba') == 'ABAAbaabaabbbaabaabbABBBABAAA'
        >>> apply_pipeline('abbaaaa') == 'ABAAABBABAAbaabaabbbaabaabbbaabaabbA'
        >>> apply_pipeline('baa') == 'BABAAbaabaabbA'
        >>> apply_pipeline('aaa') == 'ABAAbaabaabbbaabaabbA'
        >>> apply_pipeline('b') == 'B'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('a', 'abaaa')
    s = s.upper()
    s = s.upper()
    s = s.replace('AABA', 'baaa')
    s = s.replace('aA', 'baabb')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aab') == 'ABAAbaabaabbAB'
    assert candidate('b') == 'B'
    assert candidate('a') == 'ABAAA'
    assert candidate('aaabbba') == 'ABAAbaabaabbbaabaabbABBBABAAA'
    assert candidate('abbaaaa') == 'ABAAABBABAAbaabaabbbaabaabbbaabaabbA'
    assert candidate('baa') == 'BABAAbaabaabbA'
    assert candidate('aaa') == 'ABAAbaabaabbbaabaabbA'
    assert candidate('b') == 'B'

    # hidden tests
    assert candidate('ababba') == 'ABAbaaaBAAABBABAAA'
    assert candidate('bbbaabb') == 'BBBABAAbaabaabbABB'
    assert candidate('aaabaaabbb') == 'ABAAbaabaabbbaaabaaaBAAbaabaabbbaabaabbABBB'
    assert candidate('ba') == 'BABAAA'
    assert candidate('babbba') == 'BABAAABBBABAAA'
    assert candidate('a') == 'ABAAA'
    assert candidate('bbbbaba') == 'BBBBABAbaaaBAAA'
    assert candidate('bba') == 'BBABAAA'
    assert candidate('abbab') == 'ABAAABBABAAAB'
    assert candidate('abbaabb') == 'ABAAABBABAAbaabaabbABB'
    assert candidate('abbbabbb') == 'ABAAABBBABAAABBB'
    assert candidate('a') == 'ABAAA'
    assert candidate('bbbbbbbba') == 'BBBBBBBBABAAA'
    assert candidate('ababbabbb') == 'ABAbaaaBAAABBABAAABBB'
    assert candidate('babb') == 'BABAAABB'
    assert candidate('abbbaababa') == 'ABAAABBBABAAbaaabaaaBAbaaaBAAA'
    assert candidate('aa') == 'ABAAbaabaabbA'
    assert candidate('ababbba') == 'ABAbaaaBAAABBBABAAA'
    assert candidate('a') == 'ABAAA'
    assert candidate('bbaaa') == 'BBABAAbaabaabbbaabaabbA'
    assert candidate('aabbbabba') == 'ABAAbaabaabbABBBABAAABBABAAA'
    assert candidate('bbaaabbaa') == 'BBABAAbaabaabbbaabaabbABBABAAbaabaabbA'
    assert candidate('a') == 'ABAAA'
    assert candidate('b') == 'B'
    assert candidate('babaabb') == 'BABAbaaaBAAbaabaabbABB'
    assert candidate('ababb') == 'ABAbaaaBAAABB'
    assert candidate('babaaba') == 'BABAbaaaBAAbaaabaaaBAAA'
    assert candidate('aaaabba') == 'ABAAbaabaabbbaabaabbbaabaabbABBABAAA'
    assert candidate('a') == 'ABAAA'
    assert candidate('bbbaa') == 'BBBABAAbaabaabbA'
    assert candidate('bbbbbba') == 'BBBBBBABAAA'
    assert candidate('abaaa') == 'ABAbaaaBAAbaabaabbbaabaabbA'

Input: aab

Output: ABAAbaabaabbAB

Input: b

Output: B

Input: a

Output: ABAAA

Input: aaabbba

Output: ABAAbaabaabbbaabaabbABBBABAAA

Input: abbaaaa

Output: ABAAABBABAAbaabaabbbaabaabbbaabaabbA

Input: baa

Output: BABAAbaabaabbA

Input: aaa

Output: ABAAbaabaabbbaabaabbA

Input: b

Output: B

Input: ababba

Output: ABAbaaaBAAABBABAAA

Input: bbbaabb

Output: BBBABAAbaabaabbABB

Input: aaabaaabbb

Output: ABAAbaabaabbbaaabaaaBAAbaabaabbbaabaabbABBB

Input: ba

Output: BABAAA

Input: babbba

Output: BABAAABBBABAAA

Input: a

Output: ABAAA

Input: bbbbaba

Output: BBBBABAbaaaBAAA

Input: bba

Output: BBABAAA

Input: abbab

Output: ABAAABBABAAAB

Input: abbaabb

Output: ABAAABBABAAbaabaabbABB

Input: abbbabbb

Output: ABAAABBBABAAABBB

Input: a

Output: ABAAA

Input: bbbbbbbba

Output: BBBBBBBBABAAA

Input: ababbabbb

Output: ABAbaaaBAAABBABAAABBB

Input: babb

Output: BABAAABB

Input: abbbaababa

Output: ABAAABBBABAAbaaabaaaBAbaaaBAAA

Input: aa

Output: ABAAbaabaabbA

Input: ababbba

Output: ABAbaaaBAAABBBABAAA

Input: a

Output: ABAAA

Input: bbaaa

Output: BBABAAbaabaabbbaabaabbA

Input: aabbbabba

Output: ABAAbaabaabbABBBABAAABBABAAA

Input: bbaaabbaa

Output: BBABAAbaabaabbbaabaabbABBABAAbaabaabbA

Input: a

Output: ABAAA

Input: b

Output: B

Input: babaabb

Output: BABAbaaaBAAbaabaabbABB

Input: ababb

Output: ABAbaaaBAAABB

Input: babaaba

Output: BABAbaaaBAAbaaabaaaBAAA

Input: aaaabba

Output: ABAAbaabaabbbaabaabbbaabaabbABBABAAA

Input: a

Output: ABAAA

Input: bbbaa

Output: BBBABAAbaabaabbA

Input: bbbbbba

Output: BBBBBBABAAA

Input: abaaa

Output: ABAbaaaBAAbaabaabbbaabaabbA


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('bbbbbabb') == 'BBABBBBABBBBABBBBABBAA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('babbbb') == 'BBABBBBABBBBABBA'
        >>> apply_pipeline('aaaabaa') == 'BBABBAAAA'
        >>> apply_pipeline('bbbabb') == 'BBABBBBABBBBABBA'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('aaaaaa') == 'BBABBA'
        >>> apply_pipeline('aaa') == 'AAA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbbbbabb') == 'BBABBBBABBBBABBBBABBAA'
    assert candidate('a') == 'A'
    assert candidate('babbbb') == 'BBABBBBABBBBABBA'
    assert candidate('aaaabaa') == 'BBABBAAAA'
    assert candidate('bbbabb') == 'BBABBBBABBBBABBA'
    assert candidate('aaa') == 'AAA'
    assert candidate('aaaaaa') == 'BBABBA'
    assert candidate('aaa') == 'AAA'

    # hidden tests
    assert candidate('baababab') == 'BBABBBBABBBBABBA'
    assert candidate('b') == 'AAA'
    assert candidate('bbbababbab') == 'BBABBBBABBBBABBBBABBAAAA'
    assert candidate('aaaaaabba') == 'BBABBBBABBAAA'
    assert candidate('ab') == 'AAAA'
    assert candidate('abbaaaabb') == 'BBABBBBABBBBABBAA'
    assert candidate('abbabbaaba') == 'BBABBBBABBBBABBBBABB'
    assert candidate('ababaa') == 'BBABBBBABB'
    assert candidate('aaaaaaa') == 'BBABBAA'
    assert candidate('abbabbaab') == 'BBABBBBABBBBABBAAAA'
    assert candidate('a') == 'A'
    assert candidate('baaabbaab') == 'BBABBBBABBBBABBAA'
    assert candidate('baba') == 'BBABBAAA'
    assert candidate('babbab') == 'BBABBBBABBAAAA'
    assert candidate('ab') == 'AAAA'
    assert candidate('baabaaabb') == 'BBABBBBABBBBABBAA'
    assert candidate('abbbaab') == 'BBABBBBABBBBABB'
    assert candidate('bababba') == 'BBABBBBABBBBABB'
    assert candidate('bb') == 'BBABBA'
    assert candidate('baaa') == 'BBABBA'
    assert candidate('babaabbb') == 'BBABBBBABBBBABBAAA'
    assert candidate('b') == 'AAA'
    assert candidate('baab') == 'BBABBAAA'
    assert candidate('babaa') == 'BBABBAAAA'
    assert candidate('bb') == 'BBABBA'
    assert candidate('bbbb') == 'BBABBBBABBAA'
    assert candidate('b') == 'AAA'
    assert candidate('aa') == 'AA'
    assert candidate('aabaababb') == 'BBABBBBABBBBABBAA'
    assert candidate('baab') == 'BBABBAAA'
    assert candidate('bbaab') == 'BBABBBBABBA'
    assert candidate('abab') == 'BBABBAAA'

Input: bbbbbabb

Output: BBABBBBABBBBABBBBABBAA

Input: a

Output: A

Input: babbbb

Output: BBABBBBABBBBABBA

Input: aaaabaa

Output: BBABBAAAA

Input: bbbabb

Output: BBABBBBABBBBABBA

Input: aaa

Output: AAA

Input: aaaaaa

Output: BBABBA

Input: aaa

Output: AAA

Input: baababab

Output: BBABBBBABBBBABBA

Input: b

Output: AAA

Input: bbbababbab

Output: BBABBBBABBBBABBBBABBAAAA

Input: aaaaaabba

Output: BBABBBBABBAAA

Input: ab

Output: AAAA

Input: abbaaaabb

Output: BBABBBBABBBBABBAA

Input: abbabbaaba

Output: BBABBBBABBBBABBBBABB

Input: ababaa

Output: BBABBBBABB

Input: aaaaaaa

Output: BBABBAA

Input: abbabbaab

Output: BBABBBBABBBBABBAAAA

Input: a

Output: A

Input: baaabbaab

Output: BBABBBBABBBBABBAA

Input: baba

Output: BBABBAAA

Input: babbab

Output: BBABBBBABBAAAA

Input: ab

Output: AAAA

Input: baabaaabb

Output: BBABBBBABBBBABBAA

Input: abbbaab

Output: BBABBBBABBBBABB

Input: bababba

Output: BBABBBBABBBBABB

Input: bb

Output: BBABBA

Input: baaa

Output: BBABBA

Input: babaabbb

Output: BBABBBBABBBBABBAAA

Input: b

Output: AAA

Input: baab

Output: BBABBAAA

Input: babaa

Output: BBABBAAAA

Input: bb

Output: BBABBA

Input: bbbb

Output: BBABBBBABBAA

Input: b

Output: AAA

Input: aa

Output: AA

Input: aabaababb

Output: BBABBBBABBBBABBAA

Input: baab

Output: BBABBAAA

Input: bbaab

Output: BBABBBBABBA

Input: abab

Output: BBABBAAA


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('bbaabb') == 'BBAABB'
        >>> apply_pipeline('bbabaa') == 'BBABAA'
        >>> apply_pipeline('abbaaba') == 'ABBAABA'
        >>> apply_pipeline('bbaaabaa') == 'BBAAABAA'
        >>> apply_pipeline('baaab') == 'BAAAB'
        >>> apply_pipeline('abaaaaab') == 'ABAAAAAB'
        >>> apply_pipeline('bababbaaa') == 'BABABBAAA'
        >>> apply_pipeline('bb') == 'BB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.lower()
    s = s.upper()
    s = s.lower()
    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('bbaabb') == 'BBAABB'
    assert candidate('bbabaa') == 'BBABAA'
    assert candidate('abbaaba') == 'ABBAABA'
    assert candidate('bbaaabaa') == 'BBAAABAA'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('abaaaaab') == 'ABAAAAAB'
    assert candidate('bababbaaa') == 'BABABBAAA'
    assert candidate('bb') == 'BB'

    # hidden tests
    assert candidate('abaaabbb') == 'ABAAABBB'
    assert candidate('aa') == 'AA'
    assert candidate('babbaabb') == 'BABBAABB'
    assert candidate('babaaa') == 'BABAAA'
    assert candidate('ab') == 'AB'
    assert candidate('aabbbbbbb') == 'AABBBBBBB'
    assert candidate('baabbaabb') == 'BAABBAABB'
    assert candidate('baabaaab') == 'BAABAAAB'
    assert candidate('aabba') == 'AABBA'
    assert candidate('b') == 'B'
    assert candidate('abaababbbb') == 'ABAABABBBB'
    assert candidate('aaaabbbb') == 'AAAABBBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aa') == 'AA'
    assert candidate('aabbaaaa') == 'AABBAAAA'
    assert candidate('a') == 'A'
    assert candidate('b') == 'B'
    assert candidate('bbba') == 'BBBA'
    assert candidate('aaaaababaa') == 'AAAAABABAA'
    assert candidate('abaaababba') == 'ABAAABABBA'
    assert candidate('abbabbb') == 'ABBABBB'
    assert candidate('aaaabaa') == 'AAAABAA'
    assert candidate('aaabaaa') == 'AAABAAA'
    assert candidate('abbbab') == 'ABBBAB'
    assert candidate('aab') == 'AAB'
    assert candidate('a') == 'A'
    assert candidate('ababbb') == 'ABABBB'
    assert candidate('b') == 'B'
    assert candidate('bbbbbb') == 'BBBBBB'
    assert candidate('aaaaabaa') == 'AAAAABAA'
    assert candidate('aaaabbaab') == 'AAAABBAAB'
    assert candidate('aba') == 'ABA'

Input: bbaabb

Output: BBAABB

Input: bbabaa

Output: BBABAA

Input: abbaaba

Output: ABBAABA

Input: bbaaabaa

Output: BBAAABAA

Input: baaab

Output: BAAAB

Input: abaaaaab

Output: ABAAAAAB

Input: bababbaaa

Output: BABABBAAA

Input: bb

Output: BB

Input: abaaabbb

Output: ABAAABBB

Input: aa

Output: AA

Input: babbaabb

Output: BABBAABB

Input: babaaa

Output: BABAAA

Input: ab

Output: AB

Input: aabbbbbbb

Output: AABBBBBBB

Input: baabbaabb

Output: BAABBAABB

Input: baabaaab

Output: BAABAAAB

Input: aabba

Output: AABBA

Input: b

Output: B

Input: abaababbbb

Output: ABAABABBBB

Input: aaaabbbb

Output: AAAABBBB

Input: aaa

Output: AAA

Input: aa

Output: AA

Input: aabbaaaa

Output: AABBAAAA

Input: a

Output: A

Input: b

Output: B

Input: bbba

Output: BBBA

Input: aaaaababaa

Output: AAAAABABAA

Input: abaaababba

Output: ABAAABABBA

Input: abbabbb

Output: ABBABBB

Input: aaaabaa

Output: AAAABAA

Input: aaabaaa

Output: AAABAAA

Input: abbbab

Output: ABBBAB

Input: aab

Output: AAB

Input: a

Output: A

Input: ababbb

Output: ABABBB

Input: b

Output: B

Input: bbbbbb

Output: BBBBBB

Input: aaaaabaa

Output: AAAAABAA

Input: aaaabbaab

Output: AAAABBAAB

Input: aba

Output: ABA


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('ba') == 'ba'
        >>> apply_pipeline('bababb') == 'bababb'
        >>> apply_pipeline('aababbb') == 'aababbb'
        >>> apply_pipeline('abba') == 'abba'
        >>> apply_pipeline('aabba') == 'aabba'
        >>> apply_pipeline('bbabbba') == 'bbabbba'
        >>> apply_pipeline('baaab') == 'baaab'
        >>> apply_pipeline('abbabbbb') == 'abbabbbb'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('ba') == 'ba'
    assert candidate('bababb') == 'bababb'
    assert candidate('aababbb') == 'aababbb'
    assert candidate('abba') == 'abba'
    assert candidate('aabba') == 'aabba'
    assert candidate('bbabbba') == 'bbabbba'
    assert candidate('baaab') == 'baaab'
    assert candidate('abbabbbb') == 'abbabbbb'

    # hidden tests
    assert candidate('aaaa') == 'aaaa'
    assert candidate('baaabaaabb') == 'baaabaaabb'
    assert candidate('aa') == 'aa'
    assert candidate('abbaabab') == 'abbaabab'
    assert candidate('ababbbbaaa') == 'ababbbbaaa'
    assert candidate('bbab') == 'bbab'
    assert candidate('aaabababa') == 'aaabababa'
    assert candidate('aabababa') == 'aabababa'
    assert candidate('abaaabbbb') == 'abaaabbbb'
    assert candidate('ab') == 'ab'
    assert candidate('aabbaa') == 'aabbaa'
    assert candidate('bab') == 'bab'
    assert candidate('baaabb') == 'baaabb'
    assert candidate('aaba') == 'aaba'
    assert candidate('aba') == 'aba'
    assert candidate('bbbbbba') == 'bbbbbba'
    assert candidate('bbabaab') == 'bbabaab'
    assert candidate('aba') == 'aba'
    assert candidate('bb') == 'bb'
    assert candidate('baa') == 'baa'
    assert candidate('aaababab') == 'aaababab'
    assert candidate('aaab') == 'aaab'
    assert candidate('baaaababa') == 'baaaababa'
    assert candidate('b') == 'b'
    assert candidate('aaab') == 'aaab'
    assert candidate('bb') == 'bb'
    assert candidate('bbbaab') == 'bbbaab'
    assert candidate('baaa') == 'baaa'
    assert candidate('aabbbb') == 'aabbbb'
    assert candidate('bba') == 'bba'
    assert candidate('babbaa') == 'babbaa'
    assert candidate('abbbaaabb') == 'abbbaaabb'

Input: ba

Output: ba

Input: bababb

Output: bababb

Input: aababbb

Output: aababbb

Input: abba

Output: abba

Input: aabba

Output: aabba

Input: bbabbba

Output: bbabbba

Input: baaab

Output: baaab

Input: abbabbbb

Output: abbabbbb

Input: aaaa

Output: aaaa

Input: baaabaaabb

Output: baaabaaabb

Input: aa

Output: aa

Input: abbaabab

Output: abbaabab

Input: ababbbbaaa

Output: ababbbbaaa

Input: bbab

Output: bbab

Input: aaabababa

Output: aaabababa

Input: aabababa

Output: aabababa

Input: abaaabbbb

Output: abaaabbbb

Input: ab

Output: ab

Input: aabbaa

Output: aabbaa

Input: bab

Output: bab

Input: baaabb

Output: baaabb

Input: aaba

Output: aaba

Input: aba

Output: aba

Input: bbbbbba

Output: bbbbbba

Input: bbabaab

Output: bbabaab

Input: aba

Output: aba

Input: bb

Output: bb

Input: baa

Output: baa

Input: aaababab

Output: aaababab

Input: aaab

Output: aaab

Input: baaaababa

Output: baaaababa

Input: b

Output: b

Input: aaab

Output: aaab

Input: bb

Output: bb

Input: bbbaab

Output: bbbaab

Input: baaa

Output: baaa

Input: aabbbb

Output: aabbbb

Input: bba

Output: bba

Input: babbaa

Output: babbaa

Input: abbbaaabb

Output: abbbaaabb