Prompt:
from typing import List

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

    The pipeline consists of several string method calls such as:

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

    which are always applied in the same fixed order.

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

    Example input/output pairs:

        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('baaaaaaaba') == 'BAAAAAAABA'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('aababbaab') == 'AABABBAAB'
        >>> apply_pipeline('bbabbabab') == 'BBABBABAB'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('aaabb') == 'AAABB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    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('b') == 'B'
    assert candidate('aa') == 'AA'
    assert candidate('baaaaaaaba') == 'BAAAAAAABA'
    assert candidate('aa') == 'AA'
    assert candidate('aababbaab') == 'AABABBAAB'
    assert candidate('bbabbabab') == 'BBABBABAB'
    assert candidate('ba') == 'BA'
    assert candidate('aaabb') == 'AAABB'

    # hidden tests
    assert candidate('aaa') == 'AAA'
    assert candidate('aaaabbb') == 'AAAABBB'
    assert candidate('babb') == 'BABB'
    assert candidate('bbb') == 'BBB'
    assert candidate('ab') == 'AB'
    assert candidate('aaababaabb') == 'AAABABAABB'
    assert candidate('bba') == 'BBA'
    assert candidate('baabaaabb') == 'BAABAAABB'
    assert candidate('ababbbaabb') == 'ABABBBAABB'
    assert candidate('a') == 'A'
    assert candidate('ababba') == 'ABABBA'
    assert candidate('aa') == 'AA'
    assert candidate('ababaabba') == 'ABABAABBA'
    assert candidate('aaabba') == 'AAABBA'
    assert candidate('aaba') == 'AABA'
    assert candidate('bba') == 'BBA'
    assert candidate('aabab') == 'AABAB'
    assert candidate('abbb') == 'ABBB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('babbbb') == 'BABBBB'
    assert candidate('a') == 'A'
    assert candidate('abaab') == 'ABAAB'
    assert candidate('bbabab') == 'BBABAB'
    assert candidate('b') == 'B'
    assert candidate('a') == 'A'
    assert candidate('babbab') == 'BABBAB'
    assert candidate('bbbbbaabb') == 'BBBBBAABB'
    assert candidate('bba') == 'BBA'
    assert candidate('babbb') == 'BABBB'
    assert candidate('babaabba') == 'BABAABBA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('a') == 'A'

Input: b

Output: B

Input: aa

Output: AA

Input: baaaaaaaba

Output: BAAAAAAABA

Input: aa

Output: AA

Input: aababbaab

Output: AABABBAAB

Input: bbabbabab

Output: BBABBABAB

Input: ba

Output: BA

Input: aaabb

Output: AAABB

Input: aaa

Output: AAA

Input: aaaabbb

Output: AAAABBB

Input: babb

Output: BABB

Input: bbb

Output: BBB

Input: ab

Output: AB

Input: aaababaabb

Output: AAABABAABB

Input: bba

Output: BBA

Input: baabaaabb

Output: BAABAAABB

Input: ababbbaabb

Output: ABABBBAABB

Input: a

Output: A

Input: ababba

Output: ABABBA

Input: aa

Output: AA

Input: ababaabba

Output: ABABAABBA

Input: aaabba

Output: AAABBA

Input: aaba

Output: AABA

Input: bba

Output: BBA

Input: aabab

Output: AABAB

Input: abbb

Output: ABBB

Input: aaab

Output: AAAB

Input: babbbb

Output: BABBBB

Input: a

Output: A

Input: abaab

Output: ABAAB

Input: bbabab

Output: BBABAB

Input: b

Output: B

Input: a

Output: A

Input: babbab

Output: BABBAB

Input: bbbbbaabb

Output: BBBBBAABB

Input: bba

Output: BBA

Input: babbb

Output: BABBB

Input: babaabba

Output: BABAABBA

Input: baaa

Output: BAAA

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('abbbaaba') == 'abbbaaba'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('bbaba') == 'bbaba'
        >>> apply_pipeline('bbabbaba') == 'bbabbaba'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('ababbbaa') == 'ababbbaa'
        >>> apply_pipeline('aaabaabbba') == 'aaabaabbba'
        >>> apply_pipeline('bbabb') == 'bbabb'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    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('abbbaaba') == 'abbbaaba'
    assert candidate('b') == 'b'
    assert candidate('bbaba') == 'bbaba'
    assert candidate('bbabbaba') == 'bbabbaba'
    assert candidate('b') == 'b'
    assert candidate('ababbbaa') == 'ababbbaa'
    assert candidate('aaabaabbba') == 'aaabaabbba'
    assert candidate('bbabb') == 'bbabb'

    # hidden tests
    assert candidate('aba') == 'aba'
    assert candidate('abab') == 'abab'
    assert candidate('bbbbaaaa') == 'bbbbaaaa'
    assert candidate('aaaaa') == 'aaaaa'
    assert candidate('abb') == 'abb'
    assert candidate('bbaabbbaab') == 'bbaabbbaab'
    assert candidate('abaaabaaaa') == 'abaaabaaaa'
    assert candidate('bbabb') == 'bbabb'
    assert candidate('bbbaabb') == 'bbbaabb'
    assert candidate('baaaabaabb') == 'baaaabaabb'
    assert candidate('abbab') == 'abbab'
    assert candidate('bbbaab') == 'bbbaab'
    assert candidate('bbbabab') == 'bbbabab'
    assert candidate('babab') == 'babab'
    assert candidate('aabbbaa') == 'aabbbaa'
    assert candidate('abbba') == 'abbba'
    assert candidate('a') == 'a'
    assert candidate('bab') == 'bab'
    assert candidate('aa') == 'aa'
    assert candidate('aabbbbbb') == 'aabbbbbb'
    assert candidate('baba') == 'baba'
    assert candidate('aabbbbabbb') == 'aabbbbabbb'
    assert candidate('bbb') == 'bbb'
    assert candidate('bbbaab') == 'bbbaab'
    assert candidate('babb') == 'babb'
    assert candidate('babaaba') == 'babaaba'
    assert candidate('abaabaab') == 'abaabaab'
    assert candidate('bbabb') == 'bbabb'
    assert candidate('baaaba') == 'baaaba'
    assert candidate('ba') == 'ba'
    assert candidate('ba') == 'ba'
    assert candidate('aabab') == 'aabab'

Input: abbbaaba

Output: abbbaaba

Input: b

Output: b

Input: bbaba

Output: bbaba

Input: bbabbaba

Output: bbabbaba

Input: b

Output: b

Input: ababbbaa

Output: ababbbaa

Input: aaabaabbba

Output: aaabaabbba

Input: bbabb

Output: bbabb

Input: aba

Output: aba

Input: abab

Output: abab

Input: bbbbaaaa

Output: bbbbaaaa

Input: aaaaa

Output: aaaaa

Input: abb

Output: abb

Input: bbaabbbaab

Output: bbaabbbaab

Input: abaaabaaaa

Output: abaaabaaaa

Input: bbabb

Output: bbabb

Input: bbbaabb

Output: bbbaabb

Input: baaaabaabb

Output: baaaabaabb

Input: abbab

Output: abbab

Input: bbbaab

Output: bbbaab

Input: bbbabab

Output: bbbabab

Input: babab

Output: babab

Input: aabbbaa

Output: aabbbaa

Input: abbba

Output: abbba

Input: a

Output: a

Input: bab

Output: bab

Input: aa

Output: aa

Input: aabbbbbb

Output: aabbbbbb

Input: baba

Output: baba

Input: aabbbbabbb

Output: aabbbbabbb

Input: bbb

Output: bbb

Input: bbbaab

Output: bbbaab

Input: babb

Output: babb

Input: babaaba

Output: babaaba

Input: abaabaab

Output: abaabaab

Input: bbabb

Output: bbabb

Input: baaaba

Output: baaaba

Input: ba

Output: ba

Input: ba

Output: ba

Input: aabab

Output: aabab


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('bbaaba') == 'bbaaba'
        >>> apply_pipeline('baab') == 'baab'
        >>> apply_pipeline('bbbb') == 'bbbb'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('aabba') == 'aabba'
        >>> apply_pipeline('bb') == 'bb'
        >>> apply_pipeline('aa') == 'aa'
        >>> apply_pipeline('b') == 'b'
    """
    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('bbaaba') == 'bbaaba'
    assert candidate('baab') == 'baab'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('a') == 'a'
    assert candidate('aabba') == 'aabba'
    assert candidate('bb') == 'bb'
    assert candidate('aa') == 'aa'
    assert candidate('b') == 'b'

    # hidden tests
    assert candidate('abbbbba') == 'abbbbba'
    assert candidate('aaaababa') == 'aaaababa'
    assert candidate('ababbbabb') == 'ababbbabb'
    assert candidate('aaabaa') == 'aaabaa'
    assert candidate('bababa') == 'bababa'
    assert candidate('baabbbbaaa') == 'baabbbbaaa'
    assert candidate('baaaaabbbb') == 'baaaaabbbb'
    assert candidate('bbb') == 'bbb'
    assert candidate('aaaaaabbbb') == 'aaaaaabbbb'
    assert candidate('bbbaabbabb') == 'bbbaabbabb'
    assert candidate('baabaaaba') == 'baabaaaba'
    assert candidate('bbb') == 'bbb'
    assert candidate('ab') == 'ab'
    assert candidate('aababab') == 'aababab'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('bb') == 'bb'
    assert candidate('bbbabababb') == 'bbbabababb'
    assert candidate('ba') == 'ba'
    assert candidate('bbab') == 'bbab'
    assert candidate('babaa') == 'babaa'
    assert candidate('aabbaaaab') == 'aabbaaaab'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('bbbbabab') == 'bbbbabab'
    assert candidate('bbababbb') == 'bbababbb'
    assert candidate('a') == 'a'
    assert candidate('baabba') == 'baabba'
    assert candidate('abbaabab') == 'abbaabab'
    assert candidate('aa') == 'aa'
    assert candidate('bbab') == 'bbab'
    assert candidate('bbbbab') == 'bbbbab'
    assert candidate('ba') == 'ba'

Input: bbaaba

Output: bbaaba

Input: baab

Output: baab

Input: bbbb

Output: bbbb

Input: a

Output: a

Input: aabba

Output: aabba

Input: bb

Output: bb

Input: aa

Output: aa

Input: b

Output: b

Input: abbbbba

Output: abbbbba

Input: aaaababa

Output: aaaababa

Input: ababbbabb

Output: ababbbabb

Input: aaabaa

Output: aaabaa

Input: bababa

Output: bababa

Input: baabbbbaaa

Output: baabbbbaaa

Input: baaaaabbbb

Output: baaaaabbbb

Input: bbb

Output: bbb

Input: aaaaaabbbb

Output: aaaaaabbbb

Input: bbbaabbabb

Output: bbbaabbabb

Input: baabaaaba

Output: baabaaaba

Input: bbb

Output: bbb

Input: ab

Output: ab

Input: aababab

Output: aababab

Input: b

Output: b

Input: b

Output: b

Input: bb

Output: bb

Input: bbbabababb

Output: bbbabababb

Input: ba

Output: ba

Input: bbab

Output: bbab

Input: babaa

Output: babaa

Input: aabbaaaab

Output: aabbaaaab

Input: aaaa

Output: aaaa

Input: bbbbabab

Output: bbbbabab

Input: bbababbb

Output: bbababbb

Input: a

Output: a

Input: baabba

Output: baabba

Input: abbaabab

Output: abbaabab

Input: aa

Output: aa

Input: bbab

Output: bbab

Input: bbbbab

Output: bbbbab

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('baaabaab') == 'baaaabbaaaaaaa'
        >>> apply_pipeline('bbbaa') == 'baaabaaabaaaAA'
        >>> apply_pipeline('aaabbababa') == 'AaaaabaaaAbaaaAbaaaA'
        >>> apply_pipeline('bbaabbbbb') == 'baaabaaaaaaabaaabaaabaaabaaa'
        >>> apply_pipeline('b') == 'baaa'
        >>> apply_pipeline('bbbababa') == 'baaabaaabaaaAbaaaAbaaaA'
        >>> apply_pipeline('bbab') == 'baaabaaaAbaaa'
        >>> apply_pipeline('bbbbba') == 'baaabaaabaaabaaabaaaA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.upper()
    s = s.replace('B', 'baaa')
    s = s.replace('AAba', 'aa')
    s = s.replace('aAa', 'aabb')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baaabaab') == 'baaaabbaaaaaaa'
    assert candidate('bbbaa') == 'baaabaaabaaaAA'
    assert candidate('aaabbababa') == 'AaaaabaaaAbaaaAbaaaA'
    assert candidate('bbaabbbbb') == 'baaabaaaaaaabaaabaaabaaabaaa'
    assert candidate('b') == 'baaa'
    assert candidate('bbbababa') == 'baaabaaabaaaAbaaaAbaaaA'
    assert candidate('bbab') == 'baaabaaaAbaaa'
    assert candidate('bbbbba') == 'baaabaaabaaabaaabaaaA'

    # hidden tests
    assert candidate('ba') == 'baaaA'
    assert candidate('abbabbaa') == 'AbaaabaaaAbaaabaaaAA'
    assert candidate('aaaaab') == 'AAAaaaa'
    assert candidate('b') == 'baaa'
    assert candidate('bbaaabbbb') == 'baaabaaaabbaaabaaabaaabaaa'
    assert candidate('aababbb') == 'aaaaAbaaabaaabaaa'
    assert candidate('aab') == 'aaaa'
    assert candidate('aaabaabab') == 'AaaaaaaaaAbaaa'
    assert candidate('babababaa') == 'baaaAbaaaAbaaaAbaaaAA'
    assert candidate('aabaaaabab') == 'aaaaAAaaaaAbaaa'
    assert candidate('abbbbabbba') == 'AbaaabaaabaaabaaaAbaaabaaabaaaA'
    assert candidate('a') == 'A'
    assert candidate('bbbababb') == 'baaabaaabaaaAbaaaAbaaabaaa'
    assert candidate('bababa') == 'baaaAbaaaAbaaaA'
    assert candidate('abbaaaab') == 'AbaaabaaaAAaaaa'
    assert candidate('baabbaa') == 'baaaaaaabaaaAA'
    assert candidate('bbbbaabb') == 'baaabaaabaaabaaaaaaabaaa'
    assert candidate('abaa') == 'AbaaaAA'
    assert candidate('bbbaa') == 'baaabaaabaaaAA'
    assert candidate('abbbbab') == 'AbaaabaaabaaabaaaAbaaa'
    assert candidate('a') == 'A'
    assert candidate('babbba') == 'baaaAbaaabaaabaaaA'
    assert candidate('abb') == 'Abaaabaaa'
    assert candidate('baabaa') == 'baaaaaaaAA'
    assert candidate('a') == 'A'
    assert candidate('bbaabb') == 'baaabaaaaaaabaaa'
    assert candidate('bbb') == 'baaabaaabaaa'
    assert candidate('bbbabbabb') == 'baaabaaabaaaAbaaabaaaAbaaabaaa'
    assert candidate('b') == 'baaa'
    assert candidate('aabab') == 'aaaaAbaaa'
    assert candidate('aaa') == 'AAA'
    assert candidate('abbb') == 'Abaaabaaabaaa'

Input: baaabaab

Output: baaaabbaaaaaaa

Input: bbbaa

Output: baaabaaabaaaAA

Input: aaabbababa

Output: AaaaabaaaAbaaaAbaaaA

Input: bbaabbbbb

Output: baaabaaaaaaabaaabaaabaaabaaa

Input: b

Output: baaa

Input: bbbababa

Output: baaabaaabaaaAbaaaAbaaaA

Input: bbab

Output: baaabaaaAbaaa

Input: bbbbba

Output: baaabaaabaaabaaabaaaA

Input: ba

Output: baaaA

Input: abbabbaa

Output: AbaaabaaaAbaaabaaaAA

Input: aaaaab

Output: AAAaaaa

Input: b

Output: baaa

Input: bbaaabbbb

Output: baaabaaaabbaaabaaabaaabaaa

Input: aababbb

Output: aaaaAbaaabaaabaaa

Input: aab

Output: aaaa

Input: aaabaabab

Output: AaaaaaaaaAbaaa

Input: babababaa

Output: baaaAbaaaAbaaaAbaaaAA

Input: aabaaaabab

Output: aaaaAAaaaaAbaaa

Input: abbbbabbba

Output: AbaaabaaabaaabaaaAbaaabaaabaaaA

Input: a

Output: A

Input: bbbababb

Output: baaabaaabaaaAbaaaAbaaabaaa

Input: bababa

Output: baaaAbaaaAbaaaA

Input: abbaaaab

Output: AbaaabaaaAAaaaa

Input: baabbaa

Output: baaaaaaabaaaAA

Input: bbbbaabb

Output: baaabaaabaaabaaaaaaabaaa

Input: abaa

Output: AbaaaAA

Input: bbbaa

Output: baaabaaabaaaAA

Input: abbbbab

Output: AbaaabaaabaaabaaaAbaaa

Input: a

Output: A

Input: babbba

Output: baaaAbaaabaaabaaaA

Input: abb

Output: Abaaabaaa

Input: baabaa

Output: baaaaaaaAA

Input: a

Output: A

Input: bbaabb

Output: baaabaaaaaaabaaa

Input: bbb

Output: baaabaaabaaa

Input: bbbabbabb

Output: baaabaaabaaaAbaaabaaaAbaaabaaa

Input: b

Output: baaa

Input: aabab

Output: aaaaAbaaa

Input: aaa

Output: AAA

Input: abbb

Output: Abaaabaaabaaa


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('abb') == 'AB'
        >>> apply_pipeline('bababab') == 'AAA'
        >>> apply_pipeline('bbbbaabb') == 'BBBBAAB'
        >>> apply_pipeline('abba') == 'ABA'
        >>> apply_pipeline('aabbbbb') == 'AABBBB'
        >>> apply_pipeline('bbbabbaa') == 'BBBABAA'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('aabba') == 'AABA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abb') == 'AB'
    assert candidate('bababab') == 'AAA'
    assert candidate('bbbbaabb') == 'BBBBAAB'
    assert candidate('abba') == 'ABA'
    assert candidate('aabbbbb') == 'AABBBB'
    assert candidate('bbbabbaa') == 'BBBABAA'
    assert candidate('aa') == 'AA'
    assert candidate('aabba') == 'AABA'

    # hidden tests
    assert candidate('baaaaba') == 'BAAAAA'
    assert candidate('bbabaabbba') == 'BBAAABBA'
    assert candidate('abbabbbbb') == 'ABABBBB'
    assert candidate('bba') == 'BBA'
    assert candidate('baabababb') == 'BAAAAB'
    assert candidate('ababababb') == 'AAAAB'
    assert candidate('aa') == 'AA'
    assert candidate('baaaa') == 'BAAAA'
    assert candidate('abbaaaab') == 'ABAAAA'
    assert candidate('abab') == 'AA'
    assert candidate('bbbbb') == 'BBBBB'
    assert candidate('bbabba') == 'BBABA'
    assert candidate('bbaaaa') == 'BBAAAA'
    assert candidate('bbaab') == 'BBAA'
    assert candidate('babb') == 'BAB'
    assert candidate('bbbab') == 'BBBA'
    assert candidate('aba') == 'AA'
    assert candidate('aaaaabaaa') == 'AAAAAAAA'
    assert candidate('aab') == 'AA'
    assert candidate('abbaab') == 'ABAA'
    assert candidate('a') == 'A'
    assert candidate('bbabaaaaa') == 'BBAAAAAA'
    assert candidate('bbbb') == 'BBBB'
    assert candidate('bb') == 'BB'
    assert candidate('aabaaabb') == 'AAAAAB'
    assert candidate('baaaabb') == 'BAAAAB'
    assert candidate('aaaabb') == 'AAAAB'
    assert candidate('a') == 'A'
    assert candidate('aabaa') == 'AAAA'
    assert candidate('ababaabbba') == 'AAAABBA'
    assert candidate('ba') == 'BA'
    assert candidate('ba') == 'BA'

Input: abb

Output: AB

Input: bababab

Output: AAA

Input: bbbbaabb

Output: BBBBAAB

Input: abba

Output: ABA

Input: aabbbbb

Output: AABBBB

Input: bbbabbaa

Output: BBBABAA

Input: aa

Output: AA

Input: aabba

Output: AABA

Input: baaaaba

Output: BAAAAA

Input: bbabaabbba

Output: BBAAABBA

Input: abbabbbbb

Output: ABABBBB

Input: bba

Output: BBA

Input: baabababb

Output: BAAAAB

Input: ababababb

Output: AAAAB

Input: aa

Output: AA

Input: baaaa

Output: BAAAA

Input: abbaaaab

Output: ABAAAA

Input: abab

Output: AA

Input: bbbbb

Output: BBBBB

Input: bbabba

Output: BBABA

Input: bbaaaa

Output: BBAAAA

Input: bbaab

Output: BBAA

Input: babb

Output: BAB

Input: bbbab

Output: BBBA

Input: aba

Output: AA

Input: aaaaabaaa

Output: AAAAAAAA

Input: aab

Output: AA

Input: abbaab

Output: ABAA

Input: a

Output: A

Input: bbabaaaaa

Output: BBAAAAAA

Input: bbbb

Output: BBBB

Input: bb

Output: BB

Input: aabaaabb

Output: AAAAAB

Input: baaaabb

Output: BAAAAB

Input: aaaabb

Output: AAAAB

Input: a

Output: A

Input: aabaa

Output: AAAA

Input: ababaabbba

Output: AAAABBA

Input: ba

Output: BA

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('baaababb') == 'BAAABABB'
        >>> apply_pipeline('baabbba') == 'BABBAA'
        >>> apply_pipeline('bbbaa') == 'BBBAA'
        >>> apply_pipeline('aa') == 'AA'
        >>> apply_pipeline('abbbab') == 'BBAAB'
        >>> apply_pipeline('ababb') == 'ABABB'
        >>> apply_pipeline('baaabaa') == 'BAAABAA'
        >>> apply_pipeline('bbb') == 'BBB'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.upper()
    s = s.replace('ABBB', 'bba')
    s = s.replace('AAb', 'ba')
    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('baaababb') == 'BAAABABB'
    assert candidate('baabbba') == 'BABBAA'
    assert candidate('bbbaa') == 'BBBAA'
    assert candidate('aa') == 'AA'
    assert candidate('abbbab') == 'BBAAB'
    assert candidate('ababb') == 'ABABB'
    assert candidate('baaabaa') == 'BAAABAA'
    assert candidate('bbb') == 'BBB'

    # hidden tests
    assert candidate('bbbbaaa') == 'BBBBAAA'
    assert candidate('baba') == 'BABA'
    assert candidate('babbaabba') == 'BABBAABBA'
    assert candidate('abaababb') == 'ABAABABB'
    assert candidate('abaaab') == 'ABAAAB'
    assert candidate('baaaaabbab') == 'BAAAAABBAB'
    assert candidate('bbaab') == 'BBAAB'
    assert candidate('b') == 'B'
    assert candidate('aaa') == 'AAA'
    assert candidate('abbabb') == 'ABBABB'
    assert candidate('baabbbb') == 'BABBAB'
    assert candidate('baabbaba') == 'BAABBABA'
    assert candidate('abbbbba') == 'BBABBA'
    assert candidate('bbaaabaaab') == 'BBAAABAAAB'
    assert candidate('abaababa') == 'ABAABABA'
    assert candidate('babaab') == 'BABAAB'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('baabababa') == 'BAABABABA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('bbabaa') == 'BBABAA'
    assert candidate('aa') == 'AA'
    assert candidate('baabbaaa') == 'BAABBAAA'
    assert candidate('abb') == 'ABB'
    assert candidate('baabaab') == 'BAABAAB'
    assert candidate('b') == 'B'
    assert candidate('abba') == 'ABBA'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('aabbabbb') == 'AABBBBA'
    assert candidate('abaaaabaa') == 'ABAAAABAA'
    assert candidate('b') == 'B'
    assert candidate('bbbbaabab') == 'BBBBAABAB'

Input: baaababb

Output: BAAABABB

Input: baabbba

Output: BABBAA

Input: bbbaa

Output: BBBAA

Input: aa

Output: AA

Input: abbbab

Output: BBAAB

Input: ababb

Output: ABABB

Input: baaabaa

Output: BAAABAA

Input: bbb

Output: BBB

Input: bbbbaaa

Output: BBBBAAA

Input: baba

Output: BABA

Input: babbaabba

Output: BABBAABBA

Input: abaababb

Output: ABAABABB

Input: abaaab

Output: ABAAAB

Input: baaaaabbab

Output: BAAAAABBAB

Input: bbaab

Output: BBAAB

Input: b

Output: B

Input: aaa

Output: AAA

Input: abbabb

Output: ABBABB

Input: baabbbb

Output: BABBAB

Input: baabbaba

Output: BAABBABA

Input: abbbbba

Output: BBABBA

Input: bbaaabaaab

Output: BBAAABAAAB

Input: abaababa

Output: ABAABABA

Input: babaab

Output: BABAAB

Input: abaaa

Output: ABAAA

Input: baaa

Output: BAAA

Input: baabababa

Output: BAABABABA

Input: baaa

Output: BAAA

Input: bbabaa

Output: BBABAA

Input: aa

Output: AA

Input: baabbaaa

Output: BAABBAAA

Input: abb

Output: ABB

Input: baabaab

Output: BAABAAB

Input: b

Output: B

Input: abba

Output: ABBA

Input: bbaa

Output: BBAA

Input: aabbabbb

Output: AABBBBA

Input: abaaaabaa

Output: ABAAAABAA

Input: b

Output: B

Input: bbbbaabab

Output: BBBBAABAB


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('abbb') == 'abbb'
        >>> apply_pipeline('bbaaaa') == 'bbaaaa'
        >>> apply_pipeline('aaa') == 'aaa'
        >>> apply_pipeline('ababaaaaaa') == 'ababaaaaaa'
        >>> apply_pipeline('babb') == 'babb'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('baaaabaaba') == 'baaaabaaba'
    """
    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('bbab') == 'bbab'
    assert candidate('abbb') == 'abbb'
    assert candidate('bbaaaa') == 'bbaaaa'
    assert candidate('aaa') == 'aaa'
    assert candidate('ababaaaaaa') == 'ababaaaaaa'
    assert candidate('babb') == 'babb'
    assert candidate('b') == 'b'
    assert candidate('baaaabaaba') == 'baaaabaaba'

    # hidden tests
    assert candidate('bbbaa') == 'bbbaa'
    assert candidate('babaa') == 'babaa'
    assert candidate('abbbbbbbb') == 'abbbbbbbb'
    assert candidate('aba') == 'aba'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('baaaaabaa') == 'baaaaabaa'
    assert candidate('bbaaabbaba') == 'bbaaabbaba'
    assert candidate('abbabaaaaa') == 'abbabaaaaa'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('aababaaaaa') == 'aababaaaaa'
    assert candidate('babbabbba') == 'babbabbba'
    assert candidate('bbb') == 'bbb'
    assert candidate('baa') == 'baa'
    assert candidate('bbaaaba') == 'bbaaaba'
    assert candidate('baa') == 'baa'
    assert candidate('abaabbaa') == 'abaabbaa'
    assert candidate('babaaa') == 'babaaa'
    assert candidate('baaabb') == 'baaabb'
    assert candidate('abbbbba') == 'abbbbba'
    assert candidate('aabaabab') == 'aabaabab'
    assert candidate('aabab') == 'aabab'
    assert candidate('aab') == 'aab'
    assert candidate('bababaaaba') == 'bababaaaba'
    assert candidate('bbbb') == 'bbbb'
    assert candidate('aabb') == 'aabb'
    assert candidate('aba') == 'aba'
    assert candidate('abbaaaa') == 'abbaaaa'
    assert candidate('bab') == 'bab'
    assert candidate('bb') == 'bb'
    assert candidate('bbababbb') == 'bbababbb'

Input: bbab

Output: bbab

Input: abbb

Output: abbb

Input: bbaaaa

Output: bbaaaa

Input: aaa

Output: aaa

Input: ababaaaaaa

Output: ababaaaaaa

Input: babb

Output: babb

Input: b

Output: b

Input: baaaabaaba

Output: baaaabaaba

Input: bbbaa

Output: bbbaa

Input: babaa

Output: babaa

Input: abbbbbbbb

Output: abbbbbbbb

Input: aba

Output: aba

Input: b

Output: b

Input: b

Output: b

Input: baaaaabaa

Output: baaaaabaa

Input: bbaaabbaba

Output: bbaaabbaba

Input: abbabaaaaa

Output: abbabaaaaa

Input: b

Output: b

Input: b

Output: b

Input: aababaaaaa

Output: aababaaaaa

Input: babbabbba

Output: babbabbba

Input: bbb

Output: bbb

Input: baa

Output: baa

Input: bbaaaba

Output: bbaaaba

Input: baa

Output: baa

Input: abaabbaa

Output: abaabbaa

Input: babaaa

Output: babaaa

Input: baaabb

Output: baaabb

Input: abbbbba

Output: abbbbba

Input: aabaabab

Output: aabaabab

Input: aabab

Output: aabab

Input: aab

Output: aab

Input: bababaaaba

Output: bababaaaba

Input: bbbb

Output: bbbb

Input: aabb

Output: aabb

Input: aba

Output: aba

Input: abbaaaa

Output: abbaaaa

Input: bab

Output: bab

Input: bb

Output: bb

Input: bbababbb

Output: bbababbb


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('bab') == 'BAB'
        >>> apply_pipeline('abbabaaaba') == 'ABBAABABAAABA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('bbbb') == 'BBAABBBAAB'
        >>> apply_pipeline('aaaabbaaba') == 'AAAABBAABAABA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bbbbba') == 'BBAABBBAABBA'
        >>> apply_pipeline('aaab') == 'AAAB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bab') == 'BAB'
    assert candidate('abbabaaaba') == 'ABBAABABAAABA'
    assert candidate('a') == 'A'
    assert candidate('bbbb') == 'BBAABBBAAB'
    assert candidate('aaaabbaaba') == 'AAAABBAABAABA'
    assert candidate('b') == 'B'
    assert candidate('bbbbba') == 'BBAABBBAABBA'
    assert candidate('aaab') == 'AAAB'

    # hidden tests
    assert candidate('ab') == 'AB'
    assert candidate('bbbb') == 'BBAABBBAAB'
    assert candidate('bbaba') == 'BBAABABA'
    assert candidate('abaabbbaaa') == 'ABAABBAABBAAA'
    assert candidate('bbba') == 'BBAABBA'
    assert candidate('aabbab') == 'AABBAABAB'
    assert candidate('a') == 'A'
    assert candidate('baaabaab') == 'BAAABAAB'
    assert candidate('bbbbaaa') == 'BBAABBBAABAAA'
    assert candidate('abaaaa') == 'ABAAAA'
    assert candidate('bbaa') == 'BBAABAA'
    assert candidate('baaabbb') == 'BAAABBAABB'
    assert candidate('bbabbbaab') == 'BBAABABBAABBAAB'
    assert candidate('a') == 'A'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('ba') == 'BA'
    assert candidate('baaaaaa') == 'BAAAAAA'
    assert candidate('bbabbaa') == 'BBAABABBAABAA'
    assert candidate('b') == 'B'
    assert candidate('ababaab') == 'ABABAAB'
    assert candidate('ab') == 'AB'
    assert candidate('abab') == 'ABAB'
    assert candidate('baababb') == 'BAABABBAAB'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('baaaababbb') == 'BAAAABABBAABB'
    assert candidate('aaaabbbb') == 'AAAABBAABBBAAB'
    assert candidate('aa') == 'AA'
    assert candidate('a') == 'A'
    assert candidate('bbb') == 'BBAABB'
    assert candidate('babbaabbbb') == 'BABBAABAABBAABBBAAB'
    assert candidate('bbaaaaa') == 'BBAABAAAAA'
    assert candidate('bb') == 'BBAAB'

Input: bab

Output: BAB

Input: abbabaaaba

Output: ABBAABABAAABA

Input: a

Output: A

Input: bbbb

Output: BBAABBBAAB

Input: aaaabbaaba

Output: AAAABBAABAABA

Input: b

Output: B

Input: bbbbba

Output: BBAABBBAABBA

Input: aaab

Output: AAAB

Input: ab

Output: AB

Input: bbbb

Output: BBAABBBAAB

Input: bbaba

Output: BBAABABA

Input: abaabbbaaa

Output: ABAABBAABBAAA

Input: bbba

Output: BBAABBA

Input: aabbab

Output: AABBAABAB

Input: a

Output: A

Input: baaabaab

Output: BAAABAAB

Input: bbbbaaa

Output: BBAABBBAABAAA

Input: abaaaa

Output: ABAAAA

Input: bbaa

Output: BBAABAA

Input: baaabbb

Output: BAAABBAABB

Input: bbabbbaab

Output: BBAABABBAABBAAB

Input: a

Output: A

Input: aaaa

Output: AAAA

Input: ba

Output: BA

Input: baaaaaa

Output: BAAAAAA

Input: bbabbaa

Output: BBAABABBAABAA

Input: b

Output: B

Input: ababaab

Output: ABABAAB

Input: ab

Output: AB

Input: abab

Output: ABAB

Input: baababb

Output: BAABABBAAB

Input: aaaa

Output: AAAA

Input: baaaababbb

Output: BAAAABABBAABB

Input: aaaabbbb

Output: AAAABBAABBBAAB

Input: aa

Output: AA

Input: a

Output: A

Input: bbb

Output: BBAABB

Input: babbaabbbb

Output: BABBAABAABBAABBBAAB

Input: bbaaaaa

Output: BBAABAAAAA

Input: bb

Output: BBAAB


Prompt:
from typing import List

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

    The pipeline consists of several string method calls such as:

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

    which are always applied in the same fixed order.

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

    Example input/output pairs:

        >>> apply_pipeline('bbaa') == 'bbaa'
        >>> apply_pipeline('bbbbaa') == 'bbbbaa'
        >>> apply_pipeline('aabbaba') == 'aaaaba'
        >>> apply_pipeline('baba') == 'baba'
        >>> apply_pipeline('abababbbba') == 'abababbbba'
        >>> apply_pipeline('abbbaaa') == 'abbbaaa'
        >>> apply_pipeline('bbbbaaaa') == 'bbbbaaaa'
        >>> apply_pipeline('baaba') == 'baaba'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('bbab', 'aab')
    s = s.upper()
    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('bbaa') == 'bbaa'
    assert candidate('bbbbaa') == 'bbbbaa'
    assert candidate('aabbaba') == 'aaaaba'
    assert candidate('baba') == 'baba'
    assert candidate('abababbbba') == 'abababbbba'
    assert candidate('abbbaaa') == 'abbbaaa'
    assert candidate('bbbbaaaa') == 'bbbbaaaa'
    assert candidate('baaba') == 'baaba'

    # hidden tests
    assert candidate('abaaa') == 'abaaa'
    assert candidate('aaaabaaba') == 'aaaabaaba'
    assert candidate('abb') == 'abb'
    assert candidate('a') == 'a'
    assert candidate('aa') == 'aa'
    assert candidate('aabbb') == 'aabbb'
    assert candidate('bbbabaaa') == 'baabaaa'
    assert candidate('aababbabbb') == 'aabaaabbb'
    assert candidate('abaaabb') == 'abaaabb'
    assert candidate('bba') == 'bba'
    assert candidate('aaaababab') == 'aaaababab'
    assert candidate('baaa') == 'baaa'
    assert candidate('baaa') == 'baaa'
    assert candidate('abababaabb') == 'abababaabb'
    assert candidate('aaabaa') == 'aaabaa'
    assert candidate('bbbbab') == 'bbaab'
    assert candidate('baabaa') == 'baabaa'
    assert candidate('bbabbbb') == 'aabbbb'
    assert candidate('bbaaab') == 'bbaaab'
    assert candidate('aba') == 'aba'
    assert candidate('aa') == 'aa'
    assert candidate('baabbabbab') == 'baaaabbab'
    assert candidate('bab') == 'bab'
    assert candidate('aaaaba') == 'aaaaba'
    assert candidate('abb') == 'abb'
    assert candidate('a') == 'a'
    assert candidate('aabbaaab') == 'aabbaaab'
    assert candidate('bbaabab') == 'bbaabab'
    assert candidate('abbba') == 'abbba'
    assert candidate('bbabbbbba') == 'aabbbbba'
    assert candidate('abaaabaaa') == 'abaaabaaa'
    assert candidate('baa') == 'baa'

Input: bbaa

Output: bbaa

Input: bbbbaa

Output: bbbbaa

Input: aabbaba

Output: aaaaba

Input: baba

Output: baba

Input: abababbbba

Output: abababbbba

Input: abbbaaa

Output: abbbaaa

Input: bbbbaaaa

Output: bbbbaaaa

Input: baaba

Output: baaba

Input: abaaa

Output: abaaa

Input: aaaabaaba

Output: aaaabaaba

Input: abb

Output: abb

Input: a

Output: a

Input: aa

Output: aa

Input: aabbb

Output: aabbb

Input: bbbabaaa

Output: baabaaa

Input: aababbabbb

Output: aabaaabbb

Input: abaaabb

Output: abaaabb

Input: bba

Output: bba

Input: aaaababab

Output: aaaababab

Input: baaa

Output: baaa

Input: baaa

Output: baaa

Input: abababaabb

Output: abababaabb

Input: aaabaa

Output: aaabaa

Input: bbbbab

Output: bbaab

Input: baabaa

Output: baabaa

Input: bbabbbb

Output: aabbbb

Input: bbaaab

Output: bbaaab

Input: aba

Output: aba

Input: aa

Output: aa

Input: baabbabbab

Output: baaaabbab

Input: bab

Output: bab

Input: aaaaba

Output: aaaaba

Input: abb

Output: abb

Input: a

Output: a

Input: aabbaaab

Output: aabbaaab

Input: bbaabab

Output: bbaabab

Input: abbba

Output: abbba

Input: bbabbbbba

Output: aabbbbba

Input: abaaabaaa

Output: abaaabaaa

Input: baa

Output: baa


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('baaabaaab') == 'baaabaaab'
        >>> apply_pipeline('aab') == 'aab'
        >>> apply_pipeline('abbbbb') == 'abbbbb'
        >>> apply_pipeline('aabaaaabbb') == 'aabaaaabbb'
        >>> apply_pipeline('baabba') == 'baabba'
        >>> apply_pipeline('bba') == 'bba'
        >>> apply_pipeline('bbbbbbabba') == 'bbbbbbabba'
        >>> apply_pipeline('bbbbba') == 'bbbbba'
    """
    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('baaabaaab') == 'baaabaaab'
    assert candidate('aab') == 'aab'
    assert candidate('abbbbb') == 'abbbbb'
    assert candidate('aabaaaabbb') == 'aabaaaabbb'
    assert candidate('baabba') == 'baabba'
    assert candidate('bba') == 'bba'
    assert candidate('bbbbbbabba') == 'bbbbbbabba'
    assert candidate('bbbbba') == 'bbbbba'

    # hidden tests
    assert candidate('abbaaaba') == 'abbaaaba'
    assert candidate('bbabab') == 'bbabab'
    assert candidate('bbabbabb') == 'bbabbabb'
    assert candidate('bbbaaa') == 'bbbaaa'
    assert candidate('ba') == 'ba'
    assert candidate('bbaaabaab') == 'bbaaabaab'
    assert candidate('abbbbaba') == 'abbbbaba'
    assert candidate('aab') == 'aab'
    assert candidate('abbbbbbb') == 'abbbbbbb'
    assert candidate('b') == 'b'
    assert candidate('ba') == 'ba'
    assert candidate('abbbbbabbb') == 'abbbbbabbb'
    assert candidate('abb') == 'abb'
    assert candidate('baaababbbb') == 'baaababbbb'
    assert candidate('bbbbbbaaaa') == 'bbbbbbaaaa'
    assert candidate('baaa') == 'baaa'
    assert candidate('aaabaab') == 'aaabaab'
    assert candidate('aabaabbaa') == 'aabaabbaa'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('b') == 'b'
    assert candidate('bbbbaa') == 'bbbbaa'
    assert candidate('bbbbbaabbb') == 'bbbbbaabbb'
    assert candidate('babaaab') == 'babaaab'
    assert candidate('babbb') == 'babbb'
    assert candidate('b') == 'b'
    assert candidate('aabab') == 'aabab'
    assert candidate('bbaabbaba') == 'bbaabbaba'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('aba') == 'aba'
    assert candidate('bbbabaaa') == 'bbbabaaa'
    assert candidate('aaabbabaa') == 'aaabbabaa'
    assert candidate('aa') == 'aa'

Input: baaabaaab

Output: baaabaaab

Input: aab

Output: aab

Input: abbbbb

Output: abbbbb

Input: aabaaaabbb

Output: aabaaaabbb

Input: baabba

Output: baabba

Input: bba

Output: bba

Input: bbbbbbabba

Output: bbbbbbabba

Input: bbbbba

Output: bbbbba

Input: abbaaaba

Output: abbaaaba

Input: bbabab

Output: bbabab

Input: bbabbabb

Output: bbabbabb

Input: bbbaaa

Output: bbbaaa

Input: ba

Output: ba

Input: bbaaabaab

Output: bbaaabaab

Input: abbbbaba

Output: abbbbaba

Input: aab

Output: aab

Input: abbbbbbb

Output: abbbbbbb

Input: b

Output: b

Input: ba

Output: ba

Input: abbbbbabbb

Output: abbbbbabbb

Input: abb

Output: abb

Input: baaababbbb

Output: baaababbbb

Input: bbbbbbaaaa

Output: bbbbbbaaaa

Input: baaa

Output: baaa

Input: aaabaab

Output: aaabaab

Input: aabaabbaa

Output: aabaabbaa

Input: baaaa

Output: baaaa

Input: b

Output: b

Input: bbbbaa

Output: bbbbaa

Input: bbbbbaabbb

Output: bbbbbaabbb

Input: babaaab

Output: babaaab

Input: babbb

Output: babbb

Input: b

Output: b

Input: aabab

Output: aabab

Input: bbaabbaba

Output: bbaabbaba

Input: abbbbaa

Output: abbbbaa

Input: aba

Output: aba

Input: bbbabaaa

Output: bbbabaaa

Input: aaabbabaa

Output: aaabbabaa

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('ababbb') == 'ABABBB'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('baaab') == 'BAAAB'
        >>> apply_pipeline('aabbbbbbaa') == 'AABBBBBBAA'
        >>> apply_pipeline('aabab') == 'AABAB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('ab') == 'AB'
        >>> apply_pipeline('ba') == 'BA'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('aaaab', 'aaabb')
    s = s.lower()
    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('ababbb') == 'ABABBB'
    assert candidate('ba') == 'BA'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('aabbbbbbaa') == 'AABBBBBBAA'
    assert candidate('aabab') == 'AABAB'
    assert candidate('b') == 'B'
    assert candidate('ab') == 'AB'
    assert candidate('ba') == 'BA'

    # hidden tests
    assert candidate('abababa') == 'ABABABA'
    assert candidate('abb') == 'ABB'
    assert candidate('aabbbaabab') == 'AABBBAABAB'
    assert candidate('abbabbaaba') == 'ABBABBAABA'
    assert candidate('baaaabbb') == 'BAAABBBB'
    assert candidate('aabbbbabba') == 'AABBBBABBA'
    assert candidate('abbab') == 'ABBAB'
    assert candidate('a') == 'A'
    assert candidate('baaa') == 'BAAA'
    assert candidate('a') == 'A'
    assert candidate('abababbbab') == 'ABABABBBAB'
    assert candidate('aabb') == 'AABB'
    assert candidate('aababaabab') == 'AABABAABAB'
    assert candidate('b') == 'B'
    assert candidate('a') == 'A'
    assert candidate('bbaabba') == 'BBAABBA'
    assert candidate('abbaaab') == 'ABBAAAB'
    assert candidate('aaabbbbaa') == 'AAABBBBAA'
    assert candidate('bbbaba') == 'BBBABA'
    assert candidate('babaa') == 'BABAA'
    assert candidate('baabab') == 'BAABAB'
    assert candidate('abbb') == 'ABBB'
    assert candidate('aaaaabab') == 'AAAABBAB'
    assert candidate('aba') == 'ABA'
    assert candidate('aabaabbbb') == 'AABAABBBB'
    assert candidate('baaaaaab') == 'BAAAAABB'
    assert candidate('aaaabababb') == 'AAABBABABB'
    assert candidate('bbb') == 'BBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('b') == 'B'
    assert candidate('b') == 'B'
    assert candidate('aaaaabb') == 'AAAABBB'

Input: ababbb

Output: ABABBB

Input: ba

Output: BA

Input: baaab

Output: BAAAB

Input: aabbbbbbaa

Output: AABBBBBBAA

Input: aabab

Output: AABAB

Input: b

Output: B

Input: ab

Output: AB

Input: ba

Output: BA

Input: abababa

Output: ABABABA

Input: abb

Output: ABB

Input: aabbbaabab

Output: AABBBAABAB

Input: abbabbaaba

Output: ABBABBAABA

Input: baaaabbb

Output: BAAABBBB

Input: aabbbbabba

Output: AABBBBABBA

Input: abbab

Output: ABBAB

Input: a

Output: A

Input: baaa

Output: BAAA

Input: a

Output: A

Input: abababbbab

Output: ABABABBBAB

Input: aabb

Output: AABB

Input: aababaabab

Output: AABABAABAB

Input: b

Output: B

Input: a

Output: A

Input: bbaabba

Output: BBAABBA

Input: abbaaab

Output: ABBAAAB

Input: aaabbbbaa

Output: AAABBBBAA

Input: bbbaba

Output: BBBABA

Input: babaa

Output: BABAA

Input: baabab

Output: BAABAB

Input: abbb

Output: ABBB

Input: aaaaabab

Output: AAAABBAB

Input: aba

Output: ABA

Input: aabaabbbb

Output: AABAABBBB

Input: baaaaaab

Output: BAAAAABB

Input: aaaabababb

Output: AAABBABABB

Input: bbb

Output: BBB

Input: aaa

Output: AAA

Input: b

Output: B

Input: b

Output: B

Input: aaaaabb

Output: AAAABBB


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('babba') == 'BBAABABBAABBBAABA'
        >>> apply_pipeline('aaaaab') == 'AAbaabbAAB'
        >>> apply_pipeline('abbba') == 'ABBAABBBAABBBAABA'
        >>> apply_pipeline('aaabaa') == 'baabbAABAA'
        >>> apply_pipeline('b') == 'BBAAB'
        >>> apply_pipeline('abbaa') == 'ABBAABBBAABAA'
        >>> apply_pipeline('aaabbbb') == 'baabbAABBBAABBBAABBBAAB'
        >>> apply_pipeline('bb') == 'BBAABBBAAB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babba') == 'BBAABABBAABBBAABA'
    assert candidate('aaaaab') == 'AAbaabbAAB'
    assert candidate('abbba') == 'ABBAABBBAABBBAABA'
    assert candidate('aaabaa') == 'baabbAABAA'
    assert candidate('b') == 'BBAAB'
    assert candidate('abbaa') == 'ABBAABBBAABAA'
    assert candidate('aaabbbb') == 'baabbAABBBAABBBAABBBAAB'
    assert candidate('bb') == 'BBAABBBAAB'

    # hidden tests
    assert candidate('aa') == 'AA'
    assert candidate('b') == 'BBAAB'
    assert candidate('aabaabb') == 'AABBAABAABBAABBBAAB'
    assert candidate('a') == 'A'
    assert candidate('bababaabb') == 'BBAABABBAABABBAABAABBAABBBAAB'
    assert candidate('bbabaabaa') == 'BBAABBBAABABBAABAABBAABAA'
    assert candidate('aabbbabaaa') == 'AABBAABBBAABBBAABABBAABAAA'
    assert candidate('bbaaa') == 'BBAABBBAABAAA'
    assert candidate('aabaabba') == 'AABBAABAABBAABBBAABA'
    assert candidate('bbbbaabaab') == 'BBAABBBAABBBAABBBAABAABBAABAABBAAB'
    assert candidate('bb') == 'BBAABBBAAB'
    assert candidate('baaabbba') == 'BBAABbaabbAABBBAABBBAABA'
    assert candidate('bbbaab') == 'BBAABBBAABBBAABAABBAAB'
    assert candidate('bb') == 'BBAABBBAAB'
    assert candidate('abbaabab') == 'ABBAABBBAABAABBAABABBAAB'
    assert candidate('abbbbaaab') == 'ABBAABBBAABBBAABBBAABbaabbAAB'
    assert candidate('ababbba') == 'ABBAABABBAABBBAABBBAABA'
    assert candidate('aba') == 'ABBAABA'
    assert candidate('bbababbaab') == 'BBAABBBAABABBAABABBAABBBAABAABBAAB'
    assert candidate('baaaaa') == 'BBAABAAAAA'
    assert candidate('abb') == 'ABBAABBBAAB'
    assert candidate('baabbbb') == 'BBAABAABBAABBBAABBBAABBBAAB'
    assert candidate('aababa') == 'AABBAABABBAABA'
    assert candidate('aababa') == 'AABBAABABBAABA'
    assert candidate('bbbb') == 'BBAABBBAABBBAABBBAAB'
    assert candidate('bbaabaa') == 'BBAABBBAABAABBAABAA'
    assert candidate('bbbabaaaa') == 'BBAABBBAABBBAABABBAABAAAA'
    assert candidate('a') == 'A'
    assert candidate('baaabbba') == 'BBAABbaabbAABBBAABBBAABA'
    assert candidate('bbbbaaba') == 'BBAABBBAABBBAABBBAABAABBAABA'
    assert candidate('babbbaabba') == 'BBAABABBAABBBAABBBAABAABBAABBBAABA'
    assert candidate('baabbaaaba') == 'BBAABAABBAABBBAABbaabbAABA'

Input: babba

Output: BBAABABBAABBBAABA

Input: aaaaab

Output: AAbaabbAAB

Input: abbba

Output: ABBAABBBAABBBAABA

Input: aaabaa

Output: baabbAABAA

Input: b

Output: BBAAB

Input: abbaa

Output: ABBAABBBAABAA

Input: aaabbbb

Output: baabbAABBBAABBBAABBBAAB

Input: bb

Output: BBAABBBAAB

Input: aa

Output: AA

Input: b

Output: BBAAB

Input: aabaabb

Output: AABBAABAABBAABBBAAB

Input: a

Output: A

Input: bababaabb

Output: BBAABABBAABABBAABAABBAABBBAAB

Input: bbabaabaa

Output: BBAABBBAABABBAABAABBAABAA

Input: aabbbabaaa

Output: AABBAABBBAABBBAABABBAABAAA

Input: bbaaa

Output: BBAABBBAABAAA

Input: aabaabba

Output: AABBAABAABBAABBBAABA

Input: bbbbaabaab

Output: BBAABBBAABBBAABBBAABAABBAABAABBAAB

Input: bb

Output: BBAABBBAAB

Input: baaabbba

Output: BBAABbaabbAABBBAABBBAABA

Input: bbbaab

Output: BBAABBBAABBBAABAABBAAB

Input: bb

Output: BBAABBBAAB

Input: abbaabab

Output: ABBAABBBAABAABBAABABBAAB

Input: abbbbaaab

Output: ABBAABBBAABBBAABBBAABbaabbAAB

Input: ababbba

Output: ABBAABABBAABBBAABBBAABA

Input: aba

Output: ABBAABA

Input: bbababbaab

Output: BBAABBBAABABBAABABBAABBBAABAABBAAB

Input: baaaaa

Output: BBAABAAAAA

Input: abb

Output: ABBAABBBAAB

Input: baabbbb

Output: BBAABAABBAABBBAABBBAABBBAAB

Input: aababa

Output: AABBAABABBAABA

Input: aababa

Output: AABBAABABBAABA

Input: bbbb

Output: BBAABBBAABBBAABBBAAB

Input: bbaabaa

Output: BBAABBBAABAABBAABAA

Input: bbbabaaaa

Output: BBAABBBAABBBAABABBAABAAAA

Input: a

Output: A

Input: baaabbba

Output: BBAABbaabbAABBBAABBBAABA

Input: bbbbaaba

Output: BBAABBBAABBBAABBBAABAABBAABA

Input: babbbaabba

Output: BBAABABBAABBBAABBBAABAABBAABBBAABA

Input: baabbaaaba

Output: BBAABAABBAABBBAABbaabbAABA


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('bb') == 'bb'
        >>> apply_pipeline('aababaaa') == 'abaababaaa'
        >>> apply_pipeline('aaabb') == 'aaabb'
        >>> apply_pipeline('bbabaaba') == 'bbbaababaaba'
        >>> apply_pipeline('ab') == 'ab'
        >>> apply_pipeline('babba') == 'babba'
        >>> apply_pipeline('aa') == 'aa'
        >>> apply_pipeline('bb') == 'bb'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bb') == 'bb'
    assert candidate('aababaaa') == 'abaababaaa'
    assert candidate('aaabb') == 'aaabb'
    assert candidate('bbabaaba') == 'bbbaababaaba'
    assert candidate('ab') == 'ab'
    assert candidate('babba') == 'babba'
    assert candidate('aa') == 'aa'
    assert candidate('bb') == 'bb'

    # hidden tests
    assert candidate('abaaa') == 'baabaaa'
    assert candidate('ba') == 'ba'
    assert candidate('ab') == 'ab'
    assert candidate('bbaaba') == 'bbabaaba'
    assert candidate('a') == 'a'
    assert candidate('aababa') == 'abaababa'
    assert candidate('abaaaa') == 'baabaaaa'
    assert candidate('baabaaaaab') == 'babaabaaaaab'
    assert candidate('baaabbb') == 'baaabbb'
    assert candidate('aaab') == 'aaab'
    assert candidate('abbbaaaaab') == 'abbbaaaaab'
    assert candidate('ababaaaab') == 'baababaaaab'
    assert candidate('aaaabbab') == 'aaaabbab'
    assert candidate('bbaaa') == 'bbaaa'
    assert candidate('aaabaaabb') == 'aabaabaaabb'
    assert candidate('abaabaa') == 'baababaabaa'
    assert candidate('baba') == 'bbaaba'
    assert candidate('bb') == 'bb'
    assert candidate('b') == 'b'
    assert candidate('aba') == 'baaba'
    assert candidate('bababba') == 'bbaababba'
    assert candidate('aaabaa') == 'aabaabaa'
    assert candidate('bbababaa') == 'bbbaababaa'
    assert candidate('aabbabbbab') == 'aabbabbbab'
    assert candidate('abba') == 'abba'
    assert candidate('aabaababbb') == 'abaababaababbb'
    assert candidate('bb') == 'bb'
    assert candidate('aaba') == 'abaaba'
    assert candidate('bba') == 'bba'
    assert candidate('ab') == 'ab'
    assert candidate('ababb') == 'baababb'
    assert candidate('bab') == 'bab'

Input: bb

Output: bb

Input: aababaaa

Output: abaababaaa

Input: aaabb

Output: aaabb

Input: bbabaaba

Output: bbbaababaaba

Input: ab

Output: ab

Input: babba

Output: babba

Input: aa

Output: aa

Input: bb

Output: bb

Input: abaaa

Output: baabaaa

Input: ba

Output: ba

Input: ab

Output: ab

Input: bbaaba

Output: bbabaaba

Input: a

Output: a

Input: aababa

Output: abaababa

Input: abaaaa

Output: baabaaaa

Input: baabaaaaab

Output: babaabaaaaab

Input: baaabbb

Output: baaabbb

Input: aaab

Output: aaab

Input: abbbaaaaab

Output: abbbaaaaab

Input: ababaaaab

Output: baababaaaab

Input: aaaabbab

Output: aaaabbab

Input: bbaaa

Output: bbaaa

Input: aaabaaabb

Output: aabaabaaabb

Input: abaabaa

Output: baababaabaa

Input: baba

Output: bbaaba

Input: bb

Output: bb

Input: b

Output: b

Input: aba

Output: baaba

Input: bababba

Output: bbaababba

Input: aaabaa

Output: aabaabaa

Input: bbababaa

Output: bbbaababaa

Input: aabbabbbab

Output: aabbabbbab

Input: abba

Output: abba

Input: aabaababbb

Output: abaababaababbb

Input: bb

Output: bb

Input: aaba

Output: abaaba

Input: bba

Output: bba

Input: ab

Output: ab

Input: ababb

Output: baababb

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('aababaaa') == 'AABABAAA'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bbb') == 'BBB'
        >>> apply_pipeline('abbbaaabba') == 'ABBBAAABBA'
        >>> apply_pipeline('abbaaaabaa') == 'ABBAAAABAA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('aabbb') == 'AABBB'
        >>> apply_pipeline('aaa') == 'AAA'
    """
    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('aababaaa') == 'AABABAAA'
    assert candidate('b') == 'B'
    assert candidate('bbb') == 'BBB'
    assert candidate('abbbaaabba') == 'ABBBAAABBA'
    assert candidate('abbaaaabaa') == 'ABBAAAABAA'
    assert candidate('a') == 'A'
    assert candidate('aabbb') == 'AABBB'
    assert candidate('aaa') == 'AAA'

    # hidden tests
    assert candidate('babab') == 'BABAB'
    assert candidate('aab') == 'AAB'
    assert candidate('abaabbbb') == 'ABAABBBB'
    assert candidate('b') == 'B'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('bbbbbabaa') == 'BBBBBABAA'
    assert candidate('bbb') == 'BBB'
    assert candidate('baaaaaa') == 'BAAAAAA'
    assert candidate('abbaaaabb') == 'ABBAAAABB'
    assert candidate('babba') == 'BABBA'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('baaa') == 'BAAA'
    assert candidate('ba') == 'BA'
    assert candidate('ab') == 'AB'
    assert candidate('aaaaaba') == 'AAAAABA'
    assert candidate('aabaa') == 'AABAA'
    assert candidate('aa') == 'AA'
    assert candidate('baa') == 'BAA'
    assert candidate('bbb') == 'BBB'
    assert candidate('aaa') == 'AAA'
    assert candidate('aaabaaaabb') == 'AAABAAAABB'
    assert candidate('abaabbbaab') == 'ABAABBBAAB'
    assert candidate('ba') == 'BA'
    assert candidate('aabbbaab') == 'AABBBAAB'
    assert candidate('abbbbbab') == 'ABBBBBAB'
    assert candidate('baabb') == 'BAABB'
    assert candidate('aba') == 'ABA'
    assert candidate('baaabba') == 'BAAABBA'
    assert candidate('aba') == 'ABA'
    assert candidate('abaabb') == 'ABAABB'
    assert candidate('bbbbb') == 'BBBBB'
    assert candidate('babaabbb') == 'BABAABBB'

Input: aababaaa

Output: AABABAAA

Input: b

Output: B

Input: bbb

Output: BBB

Input: abbbaaabba

Output: ABBBAAABBA

Input: abbaaaabaa

Output: ABBAAAABAA

Input: a

Output: A

Input: aabbb

Output: AABBB

Input: aaa

Output: AAA

Input: babab

Output: BABAB

Input: aab

Output: AAB

Input: abaabbbb

Output: ABAABBBB

Input: b

Output: B

Input: aaaaa

Output: AAAAA

Input: bbbbbabaa

Output: BBBBBABAA

Input: bbb

Output: BBB

Input: baaaaaa

Output: BAAAAAA

Input: abbaaaabb

Output: ABBAAAABB

Input: babba

Output: BABBA

Input: aaaaa

Output: AAAAA

Input: baaa

Output: BAAA

Input: ba

Output: BA

Input: ab

Output: AB

Input: aaaaaba

Output: AAAAABA

Input: aabaa

Output: AABAA

Input: aa

Output: AA

Input: baa

Output: BAA

Input: bbb

Output: BBB

Input: aaa

Output: AAA

Input: aaabaaaabb

Output: AAABAAAABB

Input: abaabbbaab

Output: ABAABBBAAB

Input: ba

Output: BA

Input: aabbbaab

Output: AABBBAAB

Input: abbbbbab

Output: ABBBBBAB

Input: baabb

Output: BAABB

Input: aba

Output: ABA

Input: baaabba

Output: BAAABBA

Input: aba

Output: ABA

Input: abaabb

Output: ABAABB

Input: bbbbb

Output: BBBBB

Input: babaabbb

Output: BABAABBB


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('baaba') == 'baaba'
        >>> apply_pipeline('bb') == 'bb'
        >>> apply_pipeline('aaaa') == 'aaaa'
        >>> apply_pipeline('babbbba') == 'babbbba'
        >>> apply_pipeline('baaaa') == 'baaaa'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('ba') == 'ba'
        >>> apply_pipeline('bb') == 'bb'
    """
    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('baaba') == 'baaba'
    assert candidate('bb') == 'bb'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('babbbba') == 'babbbba'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('b') == 'b'
    assert candidate('ba') == 'ba'
    assert candidate('bb') == 'bb'

    # hidden tests
    assert candidate('aa') == 'aa'
    assert candidate('bbbab') == 'bbbab'
    assert candidate('babbbabab') == 'babbbabab'
    assert candidate('bbaaaabb') == 'bbaaaabb'
    assert candidate('baabb') == 'baabb'
    assert candidate('b') == 'b'
    assert candidate('baaba') == 'baaba'
    assert candidate('bbb') == 'bbb'
    assert candidate('b') == 'b'
    assert candidate('bb') == 'bb'
    assert candidate('bbaabab') == 'bbaabab'
    assert candidate('bbaaaba') == 'bbaaaba'
    assert candidate('b') == 'b'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('aab') == 'aab'
    assert candidate('bbabab') == 'bbabab'
    assert candidate('aabba') == 'aabba'
    assert candidate('baaaaab') == 'baaaaab'
    assert candidate('baab') == 'baab'
    assert candidate('bbaabaaabb') == 'bbaabaaabb'
    assert candidate('aaaabbbb') == 'aaaabbbb'
    assert candidate('baa') == 'baa'
    assert candidate('ababa') == 'ababa'
    assert candidate('b') == 'b'
    assert candidate('ababb') == 'ababb'
    assert candidate('ab') == 'ab'
    assert candidate('bba') == 'bba'
    assert candidate('bbaaaab') == 'bbaaaab'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('bbbba') == 'bbbba'
    assert candidate('aababbbaa') == 'aababbbaa'
    assert candidate('bababa') == 'bababa'

Input: baaba

Output: baaba

Input: bb

Output: bb

Input: aaaa

Output: aaaa

Input: babbbba

Output: babbbba

Input: baaaa

Output: baaaa

Input: b

Output: b

Input: ba

Output: ba

Input: bb

Output: bb

Input: aa

Output: aa

Input: bbbab

Output: bbbab

Input: babbbabab

Output: babbbabab

Input: bbaaaabb

Output: bbaaaabb

Input: baabb

Output: baabb

Input: b

Output: b

Input: baaba

Output: baaba

Input: bbb

Output: bbb

Input: b

Output: b

Input: bb

Output: bb

Input: bbaabab

Output: bbaabab

Input: bbaaaba

Output: bbaaaba

Input: b

Output: b

Input: bbaa

Output: bbaa

Input: aab

Output: aab

Input: bbabab

Output: bbabab

Input: aabba

Output: aabba

Input: baaaaab

Output: baaaaab

Input: baab

Output: baab

Input: bbaabaaabb

Output: bbaabaaabb

Input: aaaabbbb

Output: aaaabbbb

Input: baa

Output: baa

Input: ababa

Output: ababa

Input: b

Output: b

Input: ababb

Output: ababb

Input: ab

Output: ab

Input: bba

Output: bba

Input: bbaaaab

Output: bbaaaab

Input: bbaa

Output: bbaa

Input: bbbba

Output: bbbba

Input: aababbbaa

Output: aababbbaa

Input: bababa

Output: bababa


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('b') == 'b'
        >>> apply_pipeline('aaabaababa') == 'aaabaababa'
        >>> apply_pipeline('bbbbbab') == 'bbbbbab'
        >>> apply_pipeline('baabbaa') == 'baabbaa'
        >>> apply_pipeline('bbbbabba') == 'bbbbabba'
        >>> apply_pipeline('abbbbaa') == 'abbbbaa'
        >>> apply_pipeline('abb') == 'abb'
    """
    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('ba') == 'ba'
    assert candidate('b') == 'b'
    assert candidate('aaabaababa') == 'aaabaababa'
    assert candidate('bbbbbab') == 'bbbbbab'
    assert candidate('baabbaa') == 'baabbaa'
    assert candidate('bbbbabba') == 'bbbbabba'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('abb') == 'abb'

    # hidden tests
    assert candidate('babaabbbba') == 'babaabbbba'
    assert candidate('bbbaaabb') == 'bbbaaabb'
    assert candidate('abbbabbbb') == 'abbbabbbb'
    assert candidate('a') == 'a'
    assert candidate('abbba') == 'abbba'
    assert candidate('abbabbbbb') == 'abbabbbbb'
    assert candidate('aba') == 'aba'
    assert candidate('aaaababb') == 'aaaababb'
    assert candidate('aaaab') == 'aaaab'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('baaaab') == 'baaaab'
    assert candidate('bbaba') == 'bbaba'
    assert candidate('aabbaaaaa') == 'aabbaaaaa'
    assert candidate('aab') == 'aab'
    assert candidate('bbb') == 'bbb'
    assert candidate('ab') == 'ab'
    assert candidate('aaabba') == 'aaabba'
    assert candidate('bbba') == 'bbba'
    assert candidate('bb') == 'bb'
    assert candidate('baabaab') == 'baabaab'
    assert candidate('bbbabaa') == 'bbbabaa'
    assert candidate('aabbbabab') == 'aabbbabab'
    assert candidate('a') == 'a'
    assert candidate('abbbbbbaba') == 'abbbbbbaba'
    assert candidate('babbbab') == 'babbbab'
    assert candidate('ab') == 'ab'
    assert candidate('abaabba') == 'abaabba'
    assert candidate('a') == 'a'
    assert candidate('babbaabbb') == 'babbaabbb'
    assert candidate('aa') == 'aa'
    assert candidate('babbaabb') == 'babbaabb'
    assert candidate('abaab') == 'abaab'

Input: ba

Output: ba

Input: b

Output: b

Input: aaabaababa

Output: aaabaababa

Input: bbbbbab

Output: bbbbbab

Input: baabbaa

Output: baabbaa

Input: bbbbabba

Output: bbbbabba

Input: abbbbaa

Output: abbbbaa

Input: abb

Output: abb

Input: babaabbbba

Output: babaabbbba

Input: bbbaaabb

Output: bbbaaabb

Input: abbbabbbb

Output: abbbabbbb

Input: a

Output: a

Input: abbba

Output: abbba

Input: abbabbbbb

Output: abbabbbbb

Input: aba

Output: aba

Input: aaaababb

Output: aaaababb

Input: aaaab

Output: aaaab

Input: baaaa

Output: baaaa

Input: baaaab

Output: baaaab

Input: bbaba

Output: bbaba

Input: aabbaaaaa

Output: aabbaaaaa

Input: aab

Output: aab

Input: bbb

Output: bbb

Input: ab

Output: ab

Input: aaabba

Output: aaabba

Input: bbba

Output: bbba

Input: bb

Output: bb

Input: baabaab

Output: baabaab

Input: bbbabaa

Output: bbbabaa

Input: aabbbabab

Output: aabbbabab

Input: a

Output: a

Input: abbbbbbaba

Output: abbbbbbaba

Input: babbbab

Output: babbbab

Input: ab

Output: ab

Input: abaabba

Output: abaabba

Input: a

Output: a

Input: babbaabbb

Output: babbaabbb

Input: aa

Output: aa

Input: babbaabb

Output: babbaabb

Input: abaab

Output: abaab


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('abbababbba') == 'abbababbba'
        >>> apply_pipeline('bab') == 'bab'
        >>> apply_pipeline('babbaabaab') == 'babbabbb'
        >>> apply_pipeline('bb') == 'bb'
        >>> apply_pipeline('bb') == 'bb'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('babaabbaa') == 'bbbbbaa'
        >>> apply_pipeline('abaabaaa') == 'bbbaaa'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbababbba') == 'abbababbba'
    assert candidate('bab') == 'bab'
    assert candidate('babbaabaab') == 'babbabbb'
    assert candidate('bb') == 'bb'
    assert candidate('bb') == 'bb'
    assert candidate('b') == 'b'
    assert candidate('babaabbaa') == 'bbbbbaa'
    assert candidate('abaabaaa') == 'bbbaaa'

    # hidden tests
    assert candidate('bbaaabbaba') == 'bbabbbaba'
    assert candidate('abba') == 'abba'
    assert candidate('ba') == 'ba'
    assert candidate('bbab') == 'bbab'
    assert candidate('aaababba') == 'aaababba'
    assert candidate('aaaaaabab') == 'aaaaaabab'
    assert candidate('abba') == 'abba'
    assert candidate('abbbbab') == 'abbbbab'
    assert candidate('baaabbbb') == 'babbbbb'
    assert candidate('b') == 'b'
    assert candidate('baaa') == 'baaa'
    assert candidate('aaaabba') == 'aabbba'
    assert candidate('ab') == 'ab'
    assert candidate('abbaaba') == 'abbaaba'
    assert candidate('abaaba') == 'bbba'
    assert candidate('aaaabbaa') == 'aabbbaa'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('baaaabbbab') == 'baabbbbab'
    assert candidate('abbb') == 'abbb'
    assert candidate('ababbaa') == 'ababbaa'
    assert candidate('aa') == 'aa'
    assert candidate('aabbbbbaaa') == 'aabbbbbaaa'
    assert candidate('a') == 'a'
    assert candidate('bbb') == 'bbb'
    assert candidate('aabbb') == 'aabbb'
    assert candidate('baaaa') == 'baaaa'
    assert candidate('abbaaaaba') == 'abbaaaaba'
    assert candidate('bbbbbbaa') == 'bbbbbbaa'
    assert candidate('abaaaaba') == 'bbaaba'
    assert candidate('bbba') == 'bbba'
    assert candidate('aabaaba') == 'abbba'

Input: abbababbba

Output: abbababbba

Input: bab

Output: bab

Input: babbaabaab

Output: babbabbb

Input: bb

Output: bb

Input: bb

Output: bb

Input: b

Output: b

Input: babaabbaa

Output: bbbbbaa

Input: abaabaaa

Output: bbbaaa

Input: bbaaabbaba

Output: bbabbbaba

Input: abba

Output: abba

Input: ba

Output: ba

Input: bbab

Output: bbab

Input: aaababba

Output: aaababba

Input: aaaaaabab

Output: aaaaaabab

Input: abba

Output: abba

Input: abbbbab

Output: abbbbab

Input: baaabbbb

Output: babbbbb

Input: b

Output: b

Input: baaa

Output: baaa

Input: aaaabba

Output: aabbba

Input: ab

Output: ab

Input: abbaaba

Output: abbaaba

Input: abaaba

Output: bbba

Input: aaaabbaa

Output: aabbbaa

Input: b

Output: b

Input: b

Output: b

Input: baaaabbbab

Output: baabbbbab

Input: abbb

Output: abbb

Input: ababbaa

Output: ababbaa

Input: aa

Output: aa

Input: aabbbbbaaa

Output: aabbbbbaaa

Input: a

Output: a

Input: bbb

Output: bbb

Input: aabbb

Output: aabbb

Input: baaaa

Output: baaaa

Input: abbaaaaba

Output: abbaaaaba

Input: bbbbbbaa

Output: bbbbbbaa

Input: abaaaaba

Output: bbaaba

Input: bbba

Output: bbba

Input: aabaaba

Output: abbba


Prompt:
from typing import List

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

    The pipeline consists of several string method calls such as:

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

    which are always applied in the same fixed order.

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

    Example input/output pairs:

        >>> apply_pipeline('baab') == 'BAAB'
        >>> apply_pipeline('aaabbbaab') == 'AAABBBAAB'
        >>> apply_pipeline('aabbabaaa') == 'AABBABAAA'
        >>> apply_pipeline('ababbbbbab') == 'ABABBBBBAB'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('aaaabb') == 'AAAABB'
        >>> apply_pipeline('baaababaab') == 'BAAABABAAB'
        >>> apply_pipeline('babbbb') == 'BABBBB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baab') == 'BAAB'
    assert candidate('aaabbbaab') == 'AAABBBAAB'
    assert candidate('aabbabaaa') == 'AABBABAAA'
    assert candidate('ababbbbbab') == 'ABABBBBBAB'
    assert candidate('a') == 'A'
    assert candidate('aaaabb') == 'AAAABB'
    assert candidate('baaababaab') == 'BAAABABAAB'
    assert candidate('babbbb') == 'BABBBB'

    # hidden tests
    assert candidate('bab') == 'BAB'
    assert candidate('abbbbaabbb') == 'ABBBBAABBB'
    assert candidate('babaa') == 'BABAA'
    assert candidate('bbbaabaaab') == 'BBBAABAAAB'
    assert candidate('baabbabaa') == 'BAABBABAA'
    assert candidate('bbbabaaba') == 'BBBABAABA'
    assert candidate('bb') == 'BB'
    assert candidate('babaab') == 'BABAAB'
    assert candidate('ab') == 'AB'
    assert candidate('bbaaabab') == 'BBAAABAB'
    assert candidate('aaaaa') == 'AAAAA'
    assert candidate('abaaa') == 'ABAAA'
    assert candidate('abbaa') == 'ABBAA'
    assert candidate('a') == 'A'
    assert candidate('aabbbaaa') == 'AABBBAAA'
    assert candidate('aabaaaa') == 'AABAAAA'
    assert candidate('aabaaaa') == 'AABAAAA'
    assert candidate('aab') == 'AAB'
    assert candidate('abbaabbaa') == 'ABBAABBAA'
    assert candidate('abba') == 'ABBA'
    assert candidate('b') == 'B'
    assert candidate('ababaa') == 'ABABAA'
    assert candidate('baaab') == 'BAAAB'
    assert candidate('baaba') == 'BAABA'
    assert candidate('bbababbaba') == 'BBABABBABA'
    assert candidate('bbaaaaabab') == 'BBAAAAABAB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('baabaaab') == 'BAABAAAB'
    assert candidate('abbabb') == 'Aabaa'
    assert candidate('a') == 'A'
    assert candidate('baaaaa') == 'BAAAAA'
    assert candidate('bbabaabaaa') == 'BBABAABAAA'

Input: baab

Output: BAAB

Input: aaabbbaab

Output: AAABBBAAB

Input: aabbabaaa

Output: AABBABAAA

Input: ababbbbbab

Output: ABABBBBBAB

Input: a

Output: A

Input: aaaabb

Output: AAAABB

Input: baaababaab

Output: BAAABABAAB

Input: babbbb

Output: BABBBB

Input: bab

Output: BAB

Input: abbbbaabbb

Output: ABBBBAABBB

Input: babaa

Output: BABAA

Input: bbbaabaaab

Output: BBBAABAAAB

Input: baabbabaa

Output: BAABBABAA

Input: bbbabaaba

Output: BBBABAABA

Input: bb

Output: BB

Input: babaab

Output: BABAAB

Input: ab

Output: AB

Input: bbaaabab

Output: BBAAABAB

Input: aaaaa

Output: AAAAA

Input: abaaa

Output: ABAAA

Input: abbaa

Output: ABBAA

Input: a

Output: A

Input: aabbbaaa

Output: AABBBAAA

Input: aabaaaa

Output: AABAAAA

Input: aabaaaa

Output: AABAAAA

Input: aab

Output: AAB

Input: abbaabbaa

Output: ABBAABBAA

Input: abba

Output: ABBA

Input: b

Output: B

Input: ababaa

Output: ABABAA

Input: baaab

Output: BAAAB

Input: baaba

Output: BAABA

Input: bbababbaba

Output: BBABABBABA

Input: bbaaaaabab

Output: BBAAAAABAB

Input: aaab

Output: AAAB

Input: baabaaab

Output: BAABAAAB

Input: abbabb

Output: Aabaa

Input: a

Output: A

Input: baaaaa

Output: BAAAAA

Input: bbabaabaaa

Output: BBABAABAAA


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('babbbbaab') == 'babbbbaab'
        >>> apply_pipeline('abbbbbbbb') == 'abbbbbbbb'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('bbbaabaaa') == 'bbbabbaa'
        >>> apply_pipeline('aaa') == 'aaa'
        >>> apply_pipeline('aaabaaaa') == 'aabbaaa'
        >>> apply_pipeline('bbaaaba') == 'bbaabb'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('babbbbaab') == 'babbbbaab'
    assert candidate('abbbbbbbb') == 'abbbbbbbb'
    assert candidate('b') == 'b'
    assert candidate('a') == 'a'
    assert candidate('bbbaabaaa') == 'bbbabbaa'
    assert candidate('aaa') == 'aaa'
    assert candidate('aaabaaaa') == 'aabbaaa'
    assert candidate('bbaaaba') == 'bbaabb'

    # hidden tests
    assert candidate('aab') == 'aab'
    assert candidate('a') == 'a'
    assert candidate('bbabba') == 'bbabba'
    assert candidate('bab') == 'bab'
    assert candidate('abbb') == 'abbb'
    assert candidate('baababaaa') == 'babbbaaa'
    assert candidate('aababb') == 'abbbb'
    assert candidate('abaabbbbaa') == 'bbabbbbaa'
    assert candidate('ba') == 'ba'
    assert candidate('bbababbab') == 'bbbbbbab'
    assert candidate('abb') == 'abb'
    assert candidate('abbabbbab') == 'abbabbbab'
    assert candidate('aaa') == 'aaa'
    assert candidate('bbb') == 'bbb'
    assert candidate('abb') == 'abb'
    assert candidate('bbbbabb') == 'bbbbabb'
    assert candidate('baab') == 'baab'
    assert candidate('abbaabbbaa') == 'abbaabbbaa'
    assert candidate('aaba') == 'abb'
    assert candidate('bba') == 'bba'
    assert candidate('a') == 'a'
    assert candidate('baaabb') == 'baaabb'
    assert candidate('baa') == 'baa'
    assert candidate('ab') == 'ab'
    assert candidate('bababbbb') == 'bbbbbbb'
    assert candidate('aaaaab') == 'aaaaab'
    assert candidate('aabbaabbb') == 'aabbaabbb'
    assert candidate('aabaa') == 'abba'
    assert candidate('abbaaaa') == 'abbaaaa'
    assert candidate('aab') == 'aab'
    assert candidate('aaaaaa') == 'aaaaaa'
    assert candidate('baaabbaba') == 'baaabbbb'

Input: babbbbaab

Output: babbbbaab

Input: abbbbbbbb

Output: abbbbbbbb

Input: b

Output: b

Input: a

Output: a

Input: bbbaabaaa

Output: bbbabbaa

Input: aaa

Output: aaa

Input: aaabaaaa

Output: aabbaaa

Input: bbaaaba

Output: bbaabb

Input: aab

Output: aab

Input: a

Output: a

Input: bbabba

Output: bbabba

Input: bab

Output: bab

Input: abbb

Output: abbb

Input: baababaaa

Output: babbbaaa

Input: aababb

Output: abbbb

Input: abaabbbbaa

Output: bbabbbbaa

Input: ba

Output: ba

Input: bbababbab

Output: bbbbbbab

Input: abb

Output: abb

Input: abbabbbab

Output: abbabbbab

Input: aaa

Output: aaa

Input: bbb

Output: bbb

Input: abb

Output: abb

Input: bbbbabb

Output: bbbbabb

Input: baab

Output: baab

Input: abbaabbbaa

Output: abbaabbbaa

Input: aaba

Output: abb

Input: bba

Output: bba

Input: a

Output: a

Input: baaabb

Output: baaabb

Input: baa

Output: baa

Input: ab

Output: ab

Input: bababbbb

Output: bbbbbbb

Input: aaaaab

Output: aaaaab

Input: aabbaabbb

Output: aabbaabbb

Input: aabaa

Output: abba

Input: abbaaaa

Output: abbaaaa

Input: aab

Output: aab

Input: aaaaaa

Output: aaaaaa

Input: baaabbaba

Output: baaabbbb


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('bbbaa') == 'BBBAA'
        >>> apply_pipeline('bababaab') == 'ABABAAB'
        >>> apply_pipeline('ba') == 'BA'
        >>> apply_pipeline('bbaaba') == 'BBAABA'
        >>> apply_pipeline('aaaaaa') == 'AAAAAA'
        >>> apply_pipeline('bbaaabbabb') == 'BBAAABABB'
        >>> apply_pipeline('ababa') == 'BBABA'
        >>> apply_pipeline('aaaaaaabaa') == 'AAAAAAABAA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('bbbaa') == 'BBBAA'
    assert candidate('bababaab') == 'ABABAAB'
    assert candidate('ba') == 'BA'
    assert candidate('bbaaba') == 'BBAABA'
    assert candidate('aaaaaa') == 'AAAAAA'
    assert candidate('bbaaabbabb') == 'BBAAABABB'
    assert candidate('ababa') == 'BBABA'
    assert candidate('aaaaaaabaa') == 'AAAAAAABAA'

    # hidden tests
    assert candidate('ababa') == 'BBABA'
    assert candidate('aaaaaabab') == 'AAAAABBAB'
    assert candidate('abaa') == 'ABAA'
    assert candidate('ab') == 'AB'
    assert candidate('baabbba') == 'BAABBBA'
    assert candidate('bababbbbb') == 'ABABBBBB'
    assert candidate('baaa') == 'BAAA'
    assert candidate('a') == 'A'
    assert candidate('abbbab') == 'ABBAB'
    assert candidate('bbb') == 'BBB'
    assert candidate('baaaab') == 'BAAAAB'
    assert candidate('bbabab') == 'BABAB'
    assert candidate('aa') == 'AA'
    assert candidate('aaaabaabbb') == 'AAAABAABBB'
    assert candidate('aaaa') == 'AAAA'
    assert candidate('bbbbaba') == 'BBBABA'
    assert candidate('baababaa') == 'BABBABAA'
    assert candidate('bbaa') == 'BBAA'
    assert candidate('bbbbaaaa') == 'BBBBAAAA'
    assert candidate('aabbbabbaa') == 'AABBABBAA'
    assert candidate('aaba') == 'AABA'
    assert candidate('bab') == 'AB'
    assert candidate('a') == 'A'
    assert candidate('aabb') == 'AABB'
    assert candidate('ababbb') == 'BBABBB'
    assert candidate('a') == 'A'
    assert candidate('ababaa') == 'BBABAA'
    assert candidate('bababba') == 'ABABBA'
    assert candidate('bababbabab') == 'ABABABAB'
    assert candidate('baa') == 'BAA'
    assert candidate('baba') == 'ABA'
    assert candidate('aabaa') == 'AABAA'

Input: bbbaa

Output: BBBAA

Input: bababaab

Output: ABABAAB

Input: ba

Output: BA

Input: bbaaba

Output: BBAABA

Input: aaaaaa

Output: AAAAAA

Input: bbaaabbabb

Output: BBAAABABB

Input: ababa

Output: BBABA

Input: aaaaaaabaa

Output: AAAAAAABAA

Input: ababa

Output: BBABA

Input: aaaaaabab

Output: AAAAABBAB

Input: abaa

Output: ABAA

Input: ab

Output: AB

Input: baabbba

Output: BAABBBA

Input: bababbbbb

Output: ABABBBBB

Input: baaa

Output: BAAA

Input: a

Output: A

Input: abbbab

Output: ABBAB

Input: bbb

Output: BBB

Input: baaaab

Output: BAAAAB

Input: bbabab

Output: BABAB

Input: aa

Output: AA

Input: aaaabaabbb

Output: AAAABAABBB

Input: aaaa

Output: AAAA

Input: bbbbaba

Output: BBBABA

Input: baababaa

Output: BABBABAA

Input: bbaa

Output: BBAA

Input: bbbbaaaa

Output: BBBBAAAA

Input: aabbbabbaa

Output: AABBABBAA

Input: aaba

Output: AABA

Input: bab

Output: AB

Input: a

Output: A

Input: aabb

Output: AABB

Input: ababbb

Output: BBABBB

Input: a

Output: A

Input: ababaa

Output: BBABAA

Input: bababba

Output: ABABBA

Input: bababbabab

Output: ABABABAB

Input: baa

Output: BAA

Input: baba

Output: ABA

Input: aabaa

Output: AABAA


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('abbbabb') == 'ABBBABB'
        >>> apply_pipeline('bbb') == 'BBB'
        >>> apply_pipeline('aaabaa') == 'AAbab'
        >>> apply_pipeline('aaabba') == 'AAABBA'
        >>> apply_pipeline('aab') == 'AAB'
        >>> apply_pipeline('bbbabaaa') == 'BBBbabA'
        >>> apply_pipeline('aaa') == 'AAA'
        >>> apply_pipeline('aba') == 'ABA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbbabb') == 'ABBBABB'
    assert candidate('bbb') == 'BBB'
    assert candidate('aaabaa') == 'AAbab'
    assert candidate('aaabba') == 'AAABBA'
    assert candidate('aab') == 'AAB'
    assert candidate('bbbabaaa') == 'BBBbabA'
    assert candidate('aaa') == 'AAA'
    assert candidate('aba') == 'ABA'

    # hidden tests
    assert candidate('ab') == 'AB'
    assert candidate('baabaaaaab') == 'BAbabAAAB'
    assert candidate('aaab') == 'AAAB'
    assert candidate('ab') == 'AB'
    assert candidate('a') == 'A'
    assert candidate('ababbb') == 'ABABBB'
    assert candidate('abbbaabba') == 'ABBBAABBA'
    assert candidate('aabbabaab') == 'AABBbabB'
    assert candidate('aa') == 'AA'
    assert candidate('aabb') == 'AABB'
    assert candidate('bbb') == 'BBB'
    assert candidate('babaaaabaa') == 'BbabAbab'
    assert candidate('bab') == 'BAB'
    assert candidate('bb') == 'BB'
    assert candidate('baa') == 'BAA'
    assert candidate('bbaaa') == 'BBAAA'
    assert candidate('bbbbaaba') == 'BBBBAABA'
    assert candidate('bbbabb') == 'BBBABB'
    assert candidate('bbabbbaaa') == 'BBABBBAAA'
    assert candidate('aaabbabaa') == 'AAABBbab'
    assert candidate('babbbba') == 'BABBBBA'
    assert candidate('aa') == 'AA'
    assert candidate('babbabb') == 'BABBABB'
    assert candidate('bababbaaba') == 'BABABBAABA'
    assert candidate('baba') == 'BABA'
    assert candidate('bbaaaa') == 'BBAAAA'
    assert candidate('bbaaaab') == 'BBAAAAB'
    assert candidate('abbbaba') == 'ABBBABA'
    assert candidate('a') == 'A'
    assert candidate('bbaabbb') == 'BBAABBB'
    assert candidate('abbbaaaa') == 'ABBBAAAA'
    assert candidate('baabab') == 'BAABAB'

Input: abbbabb

Output: ABBBABB

Input: bbb

Output: BBB

Input: aaabaa

Output: AAbab

Input: aaabba

Output: AAABBA

Input: aab

Output: AAB

Input: bbbabaaa

Output: BBBbabA

Input: aaa

Output: AAA

Input: aba

Output: ABA

Input: ab

Output: AB

Input: baabaaaaab

Output: BAbabAAAB

Input: aaab

Output: AAAB

Input: ab

Output: AB

Input: a

Output: A

Input: ababbb

Output: ABABBB

Input: abbbaabba

Output: ABBBAABBA

Input: aabbabaab

Output: AABBbabB

Input: aa

Output: AA

Input: aabb

Output: AABB

Input: bbb

Output: BBB

Input: babaaaabaa

Output: BbabAbab

Input: bab

Output: BAB

Input: bb

Output: BB

Input: baa

Output: BAA

Input: bbaaa

Output: BBAAA

Input: bbbbaaba

Output: BBBBAABA

Input: bbbabb

Output: BBBABB

Input: bbabbbaaa

Output: BBABBBAAA

Input: aaabbabaa

Output: AAABBbab

Input: babbbba

Output: BABBBBA

Input: aa

Output: AA

Input: babbabb

Output: BABBABB

Input: bababbaaba

Output: BABABBAABA

Input: baba

Output: BABA

Input: bbaaaa

Output: BBAAAA

Input: bbaaaab

Output: BBAAAAB

Input: abbbaba

Output: ABBBABA

Input: a

Output: A

Input: bbaabbb

Output: BBAABBB

Input: abbbaaaa

Output: ABBBAAAA

Input: baabab

Output: BAABAB


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('abbabaa') == 'ABBAAABBABAB'
        >>> apply_pipeline('abaaaabaa') == 'ABBABABABABBABAB'
        >>> apply_pipeline('a') == 'AB'
        >>> apply_pipeline('baba') == 'BABBAB'
        >>> apply_pipeline('baba') == 'BABBAB'
        >>> apply_pipeline('aabaaaab') == 'ABABBABABABABB'
        >>> apply_pipeline('aaaabaaaba') == 'ABABABABBABABABBAB'
        >>> apply_pipeline('abaabbb') == 'ABBABABBBB'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abbabaa') == 'ABBAAABBABAB'
    assert candidate('abaaaabaa') == 'ABBABABABABBABAB'
    assert candidate('a') == 'AB'
    assert candidate('baba') == 'BABBAB'
    assert candidate('baba') == 'BABBAB'
    assert candidate('aabaaaab') == 'ABABBABABABABB'
    assert candidate('aaaabaaaba') == 'ABABABABBABABABBAB'
    assert candidate('abaabbb') == 'ABBABABBBB'

    # hidden tests
    assert candidate('abbbbaaabb') == 'ABBBBAAABABABBB'
    assert candidate('b') == 'B'
    assert candidate('aababba') == 'ABABBABBAAAB'
    assert candidate('abaabbabaa') == 'ABBABABBAAABBABAB'
    assert candidate('aababb') == 'ABABBABBB'
    assert candidate('bbbab') == 'BBAAABB'
    assert candidate('abbbbaba') == 'ABBBBAAABBAB'
    assert candidate('a') == 'AB'
    assert candidate('a') == 'AB'
    assert candidate('abb') == 'ABBB'
    assert candidate('aaab') == 'ABABABB'
    assert candidate('aabaaabab') == 'ABABBABABABBABB'
    assert candidate('bbaaba') == 'BBABABBAB'
    assert candidate('bab') == 'BABB'
    assert candidate('aabbbbba') == 'ABABBBBBAAAB'
    assert candidate('bb') == 'BB'
    assert candidate('ba') == 'BAB'
    assert candidate('aaba') == 'ABABBAB'
    assert candidate('aabb') == 'ABABBB'
    assert candidate('baba') == 'BABBAB'
    assert candidate('bbbaaaabbb') == 'BBAAABABABABBBB'
    assert candidate('abaabbabaa') == 'ABBABABBAAABBABAB'
    assert candidate('aaaababa') == 'ABABABABBABBAB'
    assert candidate('bbbaabba') == 'BBAAABABBAAAB'
    assert candidate('bbb') == 'BBB'
    assert candidate('b') == 'B'
    assert candidate('baabb') == 'BABABBB'
    assert candidate('baba') == 'BABBAB'
    assert candidate('bbbaaaaaaa') == 'BBAAABABABABABABAB'
    assert candidate('b') == 'B'
    assert candidate('aaba') == 'ABABBAB'
    assert candidate('bbbaabbaaa') == 'BBAAABABBAAABABAB'

Input: abbabaa

Output: ABBAAABBABAB

Input: abaaaabaa

Output: ABBABABABABBABAB

Input: a

Output: AB

Input: baba

Output: BABBAB

Input: baba

Output: BABBAB

Input: aabaaaab

Output: ABABBABABABABB

Input: aaaabaaaba

Output: ABABABABBABABABBAB

Input: abaabbb

Output: ABBABABBBB

Input: abbbbaaabb

Output: ABBBBAAABABABBB

Input: b

Output: B

Input: aababba

Output: ABABBABBAAAB

Input: abaabbabaa

Output: ABBABABBAAABBABAB

Input: aababb

Output: ABABBABBB

Input: bbbab

Output: BBAAABB

Input: abbbbaba

Output: ABBBBAAABBAB

Input: a

Output: AB

Input: a

Output: AB

Input: abb

Output: ABBB

Input: aaab

Output: ABABABB

Input: aabaaabab

Output: ABABBABABABBABB

Input: bbaaba

Output: BBABABBAB

Input: bab

Output: BABB

Input: aabbbbba

Output: ABABBBBBAAAB

Input: bb

Output: BB

Input: ba

Output: BAB

Input: aaba

Output: ABABBAB

Input: aabb

Output: ABABBB

Input: baba

Output: BABBAB

Input: bbbaaaabbb

Output: BBAAABABABABBBB

Input: abaabbabaa

Output: ABBABABBAAABBABAB

Input: aaaababa

Output: ABABABABBABBAB

Input: bbbaabba

Output: BBAAABABBAAAB

Input: bbb

Output: BBB

Input: b

Output: B

Input: baabb

Output: BABABBB

Input: baba

Output: BABBAB

Input: bbbaaaaaaa

Output: BBAAABABABABABABAB

Input: b

Output: B

Input: aaba

Output: ABABBAB

Input: bbbaabbaaa

Output: BBAAABABBAAABABAB


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') == 'baaabB'
        >>> apply_pipeline('babba') == 'BbaaabBBbaaab'
        >>> apply_pipeline('bbbbba') == 'BBBBBbaaab'
        >>> apply_pipeline('bab') == 'BbaaabB'
        >>> apply_pipeline('b') == 'B'
        >>> apply_pipeline('bbaaab') == 'BBbaaabbaaabbaaabB'
        >>> apply_pipeline('bbababaaab') == 'BBbaaabBbaaabBbaaabbaaabbaaabB'
        >>> apply_pipeline('abbbbbbba') == 'baaabBBBBBBBbaaab'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('ab') == 'baaabB'
    assert candidate('babba') == 'BbaaabBBbaaab'
    assert candidate('bbbbba') == 'BBBBBbaaab'
    assert candidate('bab') == 'BbaaabB'
    assert candidate('b') == 'B'
    assert candidate('bbaaab') == 'BBbaaabbaaabbaaabB'
    assert candidate('bbababaaab') == 'BBbaaabBbaaabBbaaabbaaabbaaabB'
    assert candidate('abbbbbbba') == 'baaabBBBBBBBbaaab'

    # hidden tests
    assert candidate('a') == 'baaab'
    assert candidate('aaaaababba') == 'baaabbaaabbaaabbaaabbaaabBbaaabBBbaaab'
    assert candidate('bb') == 'BB'
    assert candidate('aabbabaa') == 'baaabbaaabBBbaaabBbaaabbaaab'
    assert candidate('aaa') == 'baaabbaaabbaaab'
    assert candidate('abbbbabbb') == 'baaabBBBBbaaabBBB'
    assert candidate('babbbaa') == 'BbaaabBBBbaaabbaaab'
    assert candidate('babab') == 'BbaaabBbaaabB'
    assert candidate('b') == 'B'
    assert candidate('b') == 'B'
    assert candidate('bbb') == 'BBB'
    assert candidate('a') == 'baaab'
    assert candidate('abbaaa') == 'baaabBBbaaabbaaabbaaab'
    assert candidate('bbabbb') == 'BBbaaabBBB'
    assert candidate('bb') == 'BB'
    assert candidate('ababbbaa') == 'baaabBbaaabBBBbaaabbaaab'
    assert candidate('a') == 'baaab'
    assert candidate('aabb') == 'baaabbaaabBB'
    assert candidate('aaaabb') == 'baaabbaaabbaaabbaaabBB'
    assert candidate('ab') == 'baaabB'
    assert candidate('aa') == 'baaabbaaab'
    assert candidate('baababba') == 'BbaaabbaaabBbaaabBBbaaab'
    assert candidate('aabbbbaaab') == 'baaabbaaabBBBBbaaabbaaabbaaabB'
    assert candidate('aaaaaaaab') == 'baaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabB'
    assert candidate('ababaab') == 'baaabBbaaabBbaaabbaaabB'
    assert candidate('bbaabbbaa') == 'BBbaaabbaaabBBBbaaabbaaab'
    assert candidate('baa') == 'Bbaaabbaaab'
    assert candidate('aabaabbb') == 'baaabbaaabBbaaabbaaabBBB'
    assert candidate('aabaab') == 'baaabbaaabBbaaabbaaabB'
    assert candidate('aabbaab') == 'baaabbaaabBBbaaabbaaabB'
    assert candidate('babaaab') == 'BbaaabBbaaabbaaabbaaabB'
    assert candidate('a') == 'baaab'

Input: ab

Output: baaabB

Input: babba

Output: BbaaabBBbaaab

Input: bbbbba

Output: BBBBBbaaab

Input: bab

Output: BbaaabB

Input: b

Output: B

Input: bbaaab

Output: BBbaaabbaaabbaaabB

Input: bbababaaab

Output: BBbaaabBbaaabBbaaabbaaabbaaabB

Input: abbbbbbba

Output: baaabBBBBBBBbaaab

Input: a

Output: baaab

Input: aaaaababba

Output: baaabbaaabbaaabbaaabbaaabBbaaabBBbaaab

Input: bb

Output: BB

Input: aabbabaa

Output: baaabbaaabBBbaaabBbaaabbaaab

Input: aaa

Output: baaabbaaabbaaab

Input: abbbbabbb

Output: baaabBBBBbaaabBBB

Input: babbbaa

Output: BbaaabBBBbaaabbaaab

Input: babab

Output: BbaaabBbaaabB

Input: b

Output: B

Input: b

Output: B

Input: bbb

Output: BBB

Input: a

Output: baaab

Input: abbaaa

Output: baaabBBbaaabbaaabbaaab

Input: bbabbb

Output: BBbaaabBBB

Input: bb

Output: BB

Input: ababbbaa

Output: baaabBbaaabBBBbaaabbaaab

Input: a

Output: baaab

Input: aabb

Output: baaabbaaabBB

Input: aaaabb

Output: baaabbaaabbaaabbaaabBB

Input: ab

Output: baaabB

Input: aa

Output: baaabbaaab

Input: baababba

Output: BbaaabbaaabBbaaabBBbaaab

Input: aabbbbaaab

Output: baaabbaaabBBBBbaaabbaaabbaaabB

Input: aaaaaaaab

Output: baaabbaaabbaaabbaaabbaaabbaaabbaaabbaaabB

Input: ababaab

Output: baaabBbaaabBbaaabbaaabB

Input: bbaabbbaa

Output: BBbaaabbaaabBBBbaaabbaaab

Input: baa

Output: Bbaaabbaaab

Input: aabaabbb

Output: baaabbaaabBbaaabbaaabBBB

Input: aabaab

Output: baaabbaaabBbaaabbaaabB

Input: aabbaab

Output: baaabbaaabBBbaaabbaaabB

Input: babaaab

Output: BbaaabBbaaabbaaabbaaabB

Input: a

Output: baaab