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') == 'BBBbaaabbaaab'
        >>> apply_pipeline('aa') == 'baaabbaaab'
        >>> apply_pipeline('bbbaba') == 'BBBBbaaabBbaaab'
        >>> apply_pipeline('bbbbbaabaa') == 'BBBBBBBbaaabbaaabBbaaabbaaab'
        >>> apply_pipeline('ababababa') == 'baaabBbaaabBbaaabBbaaabBbaaab'
        >>> apply_pipeline('ababababb') == 'baaabBbaaabBbaaabBbaaabBBB'
        >>> apply_pipeline('ab') == 'baaabB'
        >>> apply_pipeline('bbba') == 'BBBBbaaab'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('bb', 'bbb')
    s = s.lower()
    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('bbaa') == 'BBBbaaabbaaab'
    assert candidate('aa') == 'baaabbaaab'
    assert candidate('bbbaba') == 'BBBBbaaabBbaaab'
    assert candidate('bbbbbaabaa') == 'BBBBBBBbaaabbaaabBbaaabbaaab'
    assert candidate('ababababa') == 'baaabBbaaabBbaaabBbaaabBbaaab'
    assert candidate('ababababb') == 'baaabBbaaabBbaaabBbaaabBBB'
    assert candidate('ab') == 'baaabB'
    assert candidate('bbba') == 'BBBBbaaab'

    # hidden tests
    assert candidate('bbbbabaaa') == 'BBBBBBbaaabBbaaabbaaabbaaab'
    assert candidate('bbb') == 'BBBB'
    assert candidate('aaaaaba') == 'baaabbaaabbaaabbaaabbaaabBbaaab'
    assert candidate('baabbbbba') == 'BbaaabbaaabBBBBBBBbaaab'
    assert candidate('aa') == 'baaabbaaab'
    assert candidate('bb') == 'BBB'
    assert candidate('aaaaaabb') == 'baaabbaaabbaaabbaaabbaaabbaaabBBB'
    assert candidate('bbbaaaaaaa') == 'BBBBbaaabbaaabbaaabbaaabbaaabbaaabbaaab'
    assert candidate('ba') == 'Bbaaab'
    assert candidate('abaaabba') == 'baaabBbaaabbaaabbaaabBBBbaaab'
    assert candidate('ba') == 'Bbaaab'
    assert candidate('b') == 'B'
    assert candidate('abab') == 'baaabBbaaabB'
    assert candidate('ababaa') == 'baaabBbaaabBbaaabbaaab'
    assert candidate('b') == 'B'
    assert candidate('aaaa') == 'baaabbaaabbaaabbaaab'
    assert candidate('abaabaaa') == 'baaabBbaaabbaaabBbaaabbaaabbaaab'
    assert candidate('aaabaaaab') == 'baaabbaaabbaaabBbaaabbaaabbaaabbaaabB'
    assert candidate('a') == 'baaab'
    assert candidate('bbaab') == 'BBBbaaabbaaabB'
    assert candidate('b') == 'B'
    assert candidate('abaabbaa') == 'baaabBbaaabbaaabBBBbaaabbaaab'
    assert candidate('abaaaba') == 'baaabBbaaabbaaabbaaabBbaaab'
    assert candidate('ba') == 'Bbaaab'
    assert candidate('abaabbb') == 'baaabBbaaabbaaabBBBB'
    assert candidate('ba') == 'Bbaaab'
    assert candidate('b') == 'B'
    assert candidate('ba') == 'Bbaaab'
    assert candidate('aaab') == 'baaabbaaabbaaabB'
    assert candidate('aaababba') == 'baaabbaaabbaaabBbaaabBBBbaaab'
    assert candidate('bbbb') == 'BBBBBB'
    assert candidate('aaab') == 'baaabbaaabbaaabB'

Input: bbaa

Output: BBBbaaabbaaab

Input: aa

Output: baaabbaaab

Input: bbbaba

Output: BBBBbaaabBbaaab

Input: bbbbbaabaa

Output: BBBBBBBbaaabbaaabBbaaabbaaab

Input: ababababa

Output: baaabBbaaabBbaaabBbaaabBbaaab

Input: ababababb

Output: baaabBbaaabBbaaabBbaaabBBB

Input: ab

Output: baaabB

Input: bbba

Output: BBBBbaaab

Input: bbbbabaaa

Output: BBBBBBbaaabBbaaabbaaabbaaab

Input: bbb

Output: BBBB

Input: aaaaaba

Output: baaabbaaabbaaabbaaabbaaabBbaaab

Input: baabbbbba

Output: BbaaabbaaabBBBBBBBbaaab

Input: aa

Output: baaabbaaab

Input: bb

Output: BBB

Input: aaaaaabb

Output: baaabbaaabbaaabbaaabbaaabbaaabBBB

Input: bbbaaaaaaa

Output: BBBBbaaabbaaabbaaabbaaabbaaabbaaabbaaab

Input: ba

Output: Bbaaab

Input: abaaabba

Output: baaabBbaaabbaaabbaaabBBBbaaab

Input: ba

Output: Bbaaab

Input: b

Output: B

Input: abab

Output: baaabBbaaabB

Input: ababaa

Output: baaabBbaaabBbaaabbaaab

Input: b

Output: B

Input: aaaa

Output: baaabbaaabbaaabbaaab

Input: abaabaaa

Output: baaabBbaaabbaaabBbaaabbaaabbaaab

Input: aaabaaaab

Output: baaabbaaabbaaabBbaaabbaaabbaaabbaaabB

Input: a

Output: baaab

Input: bbaab

Output: BBBbaaabbaaabB

Input: b

Output: B

Input: abaabbaa

Output: baaabBbaaabbaaabBBBbaaabbaaab

Input: abaaaba

Output: baaabBbaaabbaaabbaaabBbaaab

Input: ba

Output: Bbaaab

Input: abaabbb

Output: baaabBbaaabbaaabBBBB

Input: ba

Output: Bbaaab

Input: b

Output: B

Input: ba

Output: Bbaaab

Input: aaab

Output: baaabbaaabbaaabB

Input: aaababba

Output: baaabbaaabbaaabBbaaabBBBbaaab

Input: bbbb

Output: BBBBBB

Input: aaab

Output: baaabbaaabbaaabB


Prompt:
from typing import List

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

    The pipeline consists of several string method calls such as:

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

    which are always applied in the same fixed order.

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

    Example input/output pairs:

        >>> apply_pipeline('abaa') == 'abaa'
        >>> apply_pipeline('bab') == 'bab'
        >>> apply_pipeline('abbaaa') == 'abbaaa'
        >>> apply_pipeline('abbbabab') == 'abbbabab'
        >>> apply_pipeline('baaabb') == 'baaabb'
        >>> apply_pipeline('baabb') == 'baabb'
        >>> apply_pipeline('aabaab') == 'aabaab'
        >>> apply_pipeline('bb') == 'bb'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('abaa') == 'abaa'
    assert candidate('bab') == 'bab'
    assert candidate('abbaaa') == 'abbaaa'
    assert candidate('abbbabab') == 'abbbabab'
    assert candidate('baaabb') == 'baaabb'
    assert candidate('baabb') == 'baabb'
    assert candidate('aabaab') == 'aabaab'
    assert candidate('bb') == 'bb'

    # hidden tests
    assert candidate('aaabaa') == 'aaabaa'
    assert candidate('baaaaab') == 'bbab'
    assert candidate('a') == 'a'
    assert candidate('bbbaaaa') == 'bbbb'
    assert candidate('ababab') == 'ababab'
    assert candidate('bbbbabab') == 'bbbbabab'
    assert candidate('bbba') == 'bbba'
    assert candidate('baabbbbbb') == 'baabbbbbb'
    assert candidate('bababaabaa') == 'bababaabaa'
    assert candidate('abaaa') == 'abaaa'
    assert candidate('abbbbabaab') == 'abbbbabaab'
    assert candidate('abba') == 'abba'
    assert candidate('bba') == 'bba'
    assert candidate('abaabaa') == 'abaabaa'
    assert candidate('aabab') == 'aabab'
    assert candidate('abaaa') == 'abaaa'
    assert candidate('abab') == 'abab'
    assert candidate('ab') == 'ab'
    assert candidate('ababaaab') == 'ababaaab'
    assert candidate('baababbb') == 'baababbb'
    assert candidate('bbab') == 'bbab'
    assert candidate('bbbbaa') == 'bbbbaa'
    assert candidate('bb') == 'bb'
    assert candidate('abbabaabaa') == 'abbabaabaa'
    assert candidate('a') == 'a'
    assert candidate('bbabb') == 'bbabb'
    assert candidate('aabaaab') == 'aabaaab'
    assert candidate('baaba') == 'baaba'
    assert candidate('abbababa') == 'abbababa'
    assert candidate('ba') == 'ba'
    assert candidate('aa') == 'aa'
    assert candidate('aaaabbaa') == 'aaaabbaa'

Input: abaa

Output: abaa

Input: bab

Output: bab

Input: abbaaa

Output: abbaaa

Input: abbbabab

Output: abbbabab

Input: baaabb

Output: baaabb

Input: baabb

Output: baabb

Input: aabaab

Output: aabaab

Input: bb

Output: bb

Input: aaabaa

Output: aaabaa

Input: baaaaab

Output: bbab

Input: a

Output: a

Input: bbbaaaa

Output: bbbb

Input: ababab

Output: ababab

Input: bbbbabab

Output: bbbbabab

Input: bbba

Output: bbba

Input: baabbbbbb

Output: baabbbbbb

Input: bababaabaa

Output: bababaabaa

Input: abaaa

Output: abaaa

Input: abbbbabaab

Output: abbbbabaab

Input: abba

Output: abba

Input: bba

Output: bba

Input: abaabaa

Output: abaabaa

Input: aabab

Output: aabab

Input: abaaa

Output: abaaa

Input: abab

Output: abab

Input: ab

Output: ab

Input: ababaaab

Output: ababaaab

Input: baababbb

Output: baababbb

Input: bbab

Output: bbab

Input: bbbbaa

Output: bbbbaa

Input: bb

Output: bb

Input: abbabaabaa

Output: abbabaabaa

Input: a

Output: a

Input: bbabb

Output: bbabb

Input: aabaaab

Output: aabaaab

Input: baaba

Output: baaba

Input: abbababa

Output: abbababa

Input: ba

Output: ba

Input: aa

Output: aa

Input: aaaabbaa

Output: aaaabbaa


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('bbaabbaba') == 'bbbabaaaba'
        >>> apply_pipeline('baabaaa') == 'baabaaa'
        >>> apply_pipeline('abbabaabbb') == 'abbaababaab'
        >>> apply_pipeline('aabbb') == 'babaab'
        >>> apply_pipeline('baab') == 'baab'
        >>> apply_pipeline('abbb') == 'abbb'
        >>> apply_pipeline('abaa') == 'abaa'
    """
    raise NotImplementedError()

def apply_pipeline(s: str) -> str:
    """Canonical solution (auto-generated)."""
    s = s.replace('abaab', 'aaaab')
    s = s.lower()
    s = s.lower()
    s = s.replace('aabb', 'babaa')
    return s

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'b'
    assert candidate('bbaabbaba') == 'bbbabaaaba'
    assert candidate('baabaaa') == 'baabaaa'
    assert candidate('abbabaabbb') == 'abbaababaab'
    assert candidate('aabbb') == 'babaab'
    assert candidate('baab') == 'baab'
    assert candidate('abbb') == 'abbb'
    assert candidate('abaa') == 'abaa'

    # hidden tests
    assert candidate('baabbababa') == 'bbabaaababa'
    assert candidate('bb') == 'bb'
    assert candidate('aabbbbb') == 'babaabbb'
    assert candidate('aabaabbbbb') == 'aaababaabbb'
    assert candidate('bbabab') == 'bbabab'
    assert candidate('bab') == 'bab'
    assert candidate('aabb') == 'babaa'
    assert candidate('bbaabbabab') == 'bbbabaaabab'
    assert candidate('a') == 'a'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('aabaaaa') == 'aabaaaa'
    assert candidate('b') == 'b'
    assert candidate('aaaaa') == 'aaaaa'
    assert candidate('bbbaa') == 'bbbaa'
    assert candidate('abbbbaaa') == 'abbbbaaa'
    assert candidate('abbbaba') == 'abbbaba'
    assert candidate('aabaab') == 'aaaaab'
    assert candidate('bbbbbaaa') == 'bbbbbaaa'
    assert candidate('bbaba') == 'bbaba'
    assert candidate('bbbbbaaabb') == 'bbbbbababaa'
    assert candidate('aabba') == 'babaaa'
    assert candidate('abbbbaabb') == 'abbbbbabaa'
    assert candidate('bbbabbaa') == 'bbbabbaa'
    assert candidate('aabab') == 'aabab'
    assert candidate('abbbbbabab') == 'abbbbbabab'
    assert candidate('bbb') == 'bbb'
    assert candidate('abbaab') == 'abbaab'
    assert candidate('babba') == 'babba'
    assert candidate('baaabbaa') == 'bababaaaa'
    assert candidate('aaabbaab') == 'ababaaaab'
    assert candidate('bbbabbaaa') == 'bbbabbaaa'
    assert candidate('aabbbbbbaa') == 'babaabbbbaa'

Input: b

Output: b

Input: bbaabbaba

Output: bbbabaaaba

Input: baabaaa

Output: baabaaa

Input: abbabaabbb

Output: abbaababaab

Input: aabbb

Output: babaab

Input: baab

Output: baab

Input: abbb

Output: abbb

Input: abaa

Output: abaa

Input: baabbababa

Output: bbabaaababa

Input: bb

Output: bb

Input: aabbbbb

Output: babaabbb

Input: aabaabbbbb

Output: aaababaabbb

Input: bbabab

Output: bbabab

Input: bab

Output: bab

Input: aabb

Output: babaa

Input: bbaabbabab

Output: bbbabaaabab

Input: a

Output: a

Input: abbbbaa

Output: abbbbaa

Input: aabaaaa

Output: aabaaaa

Input: b

Output: b

Input: aaaaa

Output: aaaaa

Input: bbbaa

Output: bbbaa

Input: abbbbaaa

Output: abbbbaaa

Input: abbbaba

Output: abbbaba

Input: aabaab

Output: aaaaab

Input: bbbbbaaa

Output: bbbbbaaa

Input: bbaba

Output: bbaba

Input: bbbbbaaabb

Output: bbbbbababaa

Input: aabba

Output: babaaa

Input: abbbbaabb

Output: abbbbbabaa

Input: bbbabbaa

Output: bbbabbaa

Input: aabab

Output: aabab

Input: abbbbbabab

Output: abbbbbabab

Input: bbb

Output: bbb

Input: abbaab

Output: abbaab

Input: babba

Output: babba

Input: baaabbaa

Output: bababaaaa

Input: aaabbaab

Output: ababaaaab

Input: bbbabbaaa

Output: bbbabbaaa

Input: aabbbbbbaa

Output: babaabbbbaa


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('baabbaaaa') == 'bAAAbAbAAAAA'
        >>> apply_pipeline('baaaaaab') == 'bAAAAAAAbA'
        >>> apply_pipeline('baaabab') == 'bAAAAbAAbA'
        >>> apply_pipeline('a') == 'A'
        >>> apply_pipeline('ababaab') == 'AbAAbAAAbA'
        >>> apply_pipeline('baababba') == 'bAAAbAAbAbAA'
        >>> apply_pipeline('bbaaab') == 'bAbAAAAbA'
        >>> apply_pipeline('baaa') == 'bAAAA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('baabbaaaa') == 'bAAAbAbAAAAA'
    assert candidate('baaaaaab') == 'bAAAAAAAbA'
    assert candidate('baaabab') == 'bAAAAbAAbA'
    assert candidate('a') == 'A'
    assert candidate('ababaab') == 'AbAAbAAAbA'
    assert candidate('baababba') == 'bAAAbAAbAbAA'
    assert candidate('bbaaab') == 'bAbAAAAbA'
    assert candidate('baaa') == 'bAAAA'

    # hidden tests
    assert candidate('baaaba') == 'bAAAAbAA'
    assert candidate('ab') == 'AbA'
    assert candidate('bb') == 'bAbA'
    assert candidate('baabbaaba') == 'bAAAbAbAAAbAA'
    assert candidate('a') == 'A'
    assert candidate('bbbbabbbb') == 'bAbAbAbAAbAbAbAbA'
    assert candidate('bbb') == 'bAbAbA'
    assert candidate('a') == 'A'
    assert candidate('bab') == 'bAAbA'
    assert candidate('bbaaaa') == 'bAbAAAAA'
    assert candidate('baabbabb') == 'bAAAbAbAAbAbA'
    assert candidate('abbb') == 'AbAbAbA'
    assert candidate('baaaabbb') == 'bAAAAAbAbAbA'
    assert candidate('b') == 'bA'
    assert candidate('abaa') == 'AbAAA'
    assert candidate('aa') == 'AA'
    assert candidate('a') == 'A'
    assert candidate('baabbab') == 'bAAAbAbAAbA'
    assert candidate('bb') == 'bAbA'
    assert candidate('bbaabab') == 'bAbAAAbAAbA'
    assert candidate('bbb') == 'bAbAbA'
    assert candidate('aaaaaa') == 'AAAAAA'
    assert candidate('a') == 'A'
    assert candidate('aaaabaa') == 'AAAAbAAA'
    assert candidate('b') == 'bA'
    assert candidate('abbba') == 'AbAbAbAA'
    assert candidate('b') == 'bA'
    assert candidate('b') == 'bA'
    assert candidate('aab') == 'AAbA'
    assert candidate('aaabbbbb') == 'AAAbAbAbAbAbA'
    assert candidate('ab') == 'AbA'
    assert candidate('b') == 'bA'

Input: baabbaaaa

Output: bAAAbAbAAAAA

Input: baaaaaab

Output: bAAAAAAAbA

Input: baaabab

Output: bAAAAbAAbA

Input: a

Output: A

Input: ababaab

Output: AbAAbAAAbA

Input: baababba

Output: bAAAbAAbAbAA

Input: bbaaab

Output: bAbAAAAbA

Input: baaa

Output: bAAAA

Input: baaaba

Output: bAAAAbAA

Input: ab

Output: AbA

Input: bb

Output: bAbA

Input: baabbaaba

Output: bAAAbAbAAAbAA

Input: a

Output: A

Input: bbbbabbbb

Output: bAbAbAbAAbAbAbAbA

Input: bbb

Output: bAbAbA

Input: a

Output: A

Input: bab

Output: bAAbA

Input: bbaaaa

Output: bAbAAAAA

Input: baabbabb

Output: bAAAbAbAAbAbA

Input: abbb

Output: AbAbAbA

Input: baaaabbb

Output: bAAAAAbAbAbA

Input: b

Output: bA

Input: abaa

Output: AbAAA

Input: aa

Output: AA

Input: a

Output: A

Input: baabbab

Output: bAAAbAbAAbA

Input: bb

Output: bAbA

Input: bbaabab

Output: bAbAAAbAAbA

Input: bbb

Output: bAbAbA

Input: aaaaaa

Output: AAAAAA

Input: a

Output: A

Input: aaaabaa

Output: AAAAbAAA

Input: b

Output: bA

Input: abbba

Output: AbAbAbAA

Input: b

Output: bA

Input: b

Output: bA

Input: aab

Output: AAbA

Input: aaabbbbb

Output: AAAbAbAbAbAbA

Input: ab

Output: AbA

Input: b

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('b') == 'B'
        >>> apply_pipeline('bbab') == 'BBAB'
        >>> apply_pipeline('aababa') == 'AABABA'
        >>> apply_pipeline('bbbabb') == 'BBBABB'
        >>> apply_pipeline('aba') == 'ABA'
        >>> apply_pipeline('baaababba') == 'BaBBA'
        >>> apply_pipeline('aabbaaab') == 'AABBAAAB'
        >>> apply_pipeline('aaba') == 'AABA'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('b') == 'B'
    assert candidate('bbab') == 'BBAB'
    assert candidate('aababa') == 'AABABA'
    assert candidate('bbbabb') == 'BBBABB'
    assert candidate('aba') == 'ABA'
    assert candidate('baaababba') == 'BaBBA'
    assert candidate('aabbaaab') == 'AABBAAAB'
    assert candidate('aaba') == 'AABA'

    # hidden tests
    assert candidate('aababa') == 'AABABA'
    assert candidate('abbabba') == 'ABBABBA'
    assert candidate('babba') == 'BABBA'
    assert candidate('bbaabba') == 'BBAABBA'
    assert candidate('b') == 'B'
    assert candidate('bbaaa') == 'BBAAA'
    assert candidate('abbaaba') == 'ABBAABA'
    assert candidate('aabbbab') == 'AABBBAB'
    assert candidate('bba') == 'BBA'
    assert candidate('aaba') == 'AABA'
    assert candidate('bbb') == 'BBB'
    assert candidate('baba') == 'BABA'
    assert candidate('bbbbbbaabb') == 'BBBBBBAABB'
    assert candidate('bbabaabbab') == 'BBABAABBAB'
    assert candidate('ab') == 'AB'
    assert candidate('bbb') == 'BBB'
    assert candidate('abaabbbb') == 'ABAABBBB'
    assert candidate('abbbbbbaa') == 'ABBBBBBAA'
    assert candidate('aaabbabaa') == 'AAABBABAA'
    assert candidate('baabba') == 'BAABBA'
    assert candidate('abaab') == 'ABAAB'
    assert candidate('babb') == 'BABB'
    assert candidate('bbabaa') == 'BBABAA'
    assert candidate('aaabbaaaab') == 'AAABBAAAAB'
    assert candidate('bbaaabbaa') == 'BBAAABBAA'
    assert candidate('babbbaaa') == 'BABBBAAA'
    assert candidate('bbbbaaaa') == 'BBBBAAAA'
    assert candidate('aaabbabbb') == 'AAABBABBB'
    assert candidate('a') == 'A'
    assert candidate('abbbbabbba') == 'ABBBBABBBA'
    assert candidate('aaabbbaba') == 'AAABBBABA'
    assert candidate('a') == 'A'

Input: b

Output: B

Input: bbab

Output: BBAB

Input: aababa

Output: AABABA

Input: bbbabb

Output: BBBABB

Input: aba

Output: ABA

Input: baaababba

Output: BaBBA

Input: aabbaaab

Output: AABBAAAB

Input: aaba

Output: AABA

Input: aababa

Output: AABABA

Input: abbabba

Output: ABBABBA

Input: babba

Output: BABBA

Input: bbaabba

Output: BBAABBA

Input: b

Output: B

Input: bbaaa

Output: BBAAA

Input: abbaaba

Output: ABBAABA

Input: aabbbab

Output: AABBBAB

Input: bba

Output: BBA

Input: aaba

Output: AABA

Input: bbb

Output: BBB

Input: baba

Output: BABA

Input: bbbbbbaabb

Output: BBBBBBAABB

Input: bbabaabbab

Output: BBABAABBAB

Input: ab

Output: AB

Input: bbb

Output: BBB

Input: abaabbbb

Output: ABAABBBB

Input: abbbbbbaa

Output: ABBBBBBAA

Input: aaabbabaa

Output: AAABBABAA

Input: baabba

Output: BAABBA

Input: abaab

Output: ABAAB

Input: babb

Output: BABB

Input: bbabaa

Output: BBABAA

Input: aaabbaaaab

Output: AAABBAAAAB

Input: bbaaabbaa

Output: BBAAABBAA

Input: babbbaaa

Output: BABBBAAA

Input: bbbbaaaa

Output: BBBBAAAA

Input: aaabbabbb

Output: AAABBABBB

Input: a

Output: A

Input: abbbbabbba

Output: ABBBBABBBA

Input: aaabbbaba

Output: AAABBBABA

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('aaabbba') == 'aaabbba'
        >>> apply_pipeline('baabba') == 'baabba'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('babbbaaaba') == 'babbbaaaba'
        >>> apply_pipeline('bbb') == 'bbb'
        >>> apply_pipeline('a') == 'a'
        >>> apply_pipeline('abbbbaa') == 'abbbbaa'
        >>> apply_pipeline('aba') == 'aba'
    """
    raise NotImplementedError()

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

from typing import Callable

def check(candidate: Callable[[str], str]) -> None:
    # examples from the prompt
    assert candidate('aaabbba') == 'aaabbba'
    assert candidate('baabba') == 'baabba'
    assert candidate('a') == 'a'
    assert candidate('babbbaaaba') == 'babbbaaaba'
    assert candidate('bbb') == 'bbb'
    assert candidate('a') == 'a'
    assert candidate('abbbbaa') == 'abbbbaa'
    assert candidate('aba') == 'aba'

    # hidden tests
    assert candidate('bbbbbbbab') == 'bbbbbbbab'
    assert candidate('bbbbabbbb') == 'bbbbabbbb'
    assert candidate('abbbaaaaa') == 'abbba'
    assert candidate('bbb') == 'bbb'
    assert candidate('bbaabbb') == 'bbaabbb'
    assert candidate('bbb') == 'bbb'
    assert candidate('ababbabb') == 'ababbabb'
    assert candidate('abab') == 'abab'
    assert candidate('baaabaabbb') == 'baaabaabbb'
    assert candidate('baaaaa') == 'ba'
    assert candidate('bab') == 'bab'
    assert candidate('aaaabbbb') == 'aaaabbbb'
    assert candidate('baba') == 'baba'
    assert candidate('babababbbb') == 'babababbbb'
    assert candidate('abbbababab') == 'abbbababab'
    assert candidate('bbbabaab') == 'bbbabaab'
    assert candidate('aabaab') == 'aabaab'
    assert candidate('aaba') == 'aaba'
    assert candidate('bbbaab') == 'bbbaab'
    assert candidate('bbbbba') == 'bbbbba'
    assert candidate('baa') == 'baa'
    assert candidate('b') == 'b'
    assert candidate('abaaabbaa') == 'abaaabbaa'
    assert candidate('bbaa') == 'bbaa'
    assert candidate('baa') == 'baa'
    assert candidate('bbbaa') == 'bbbaa'
    assert candidate('abbabab') == 'abbabab'
    assert candidate('abaabaaaab') == 'abaabaaaab'
    assert candidate('aaaab') == 'aaaab'
    assert candidate('b') == 'b'
    assert candidate('abbaabb') == 'abbaabb'
    assert candidate('a') == 'a'

Input: aaabbba

Output: aaabbba

Input: baabba

Output: baabba

Input: a

Output: a

Input: babbbaaaba

Output: babbbaaaba

Input: bbb

Output: bbb

Input: a

Output: a

Input: abbbbaa

Output: abbbbaa

Input: aba

Output: aba

Input: bbbbbbbab

Output: bbbbbbbab

Input: bbbbabbbb

Output: bbbbabbbb

Input: abbbaaaaa

Output: abbba

Input: bbb

Output: bbb

Input: bbaabbb

Output: bbaabbb

Input: bbb

Output: bbb

Input: ababbabb

Output: ababbabb

Input: abab

Output: abab

Input: baaabaabbb

Output: baaabaabbb

Input: baaaaa

Output: ba

Input: bab

Output: bab

Input: aaaabbbb

Output: aaaabbbb

Input: baba

Output: baba

Input: babababbbb

Output: babababbbb

Input: abbbababab

Output: abbbababab

Input: bbbabaab

Output: bbbabaab

Input: aabaab

Output: aabaab

Input: aaba

Output: aaba

Input: bbbaab

Output: bbbaab

Input: bbbbba

Output: bbbbba

Input: baa

Output: baa

Input: b

Output: b

Input: abaaabbaa

Output: abaaabbaa

Input: bbaa

Output: bbaa

Input: baa

Output: baa

Input: bbbaa

Output: bbbaa

Input: abbabab

Output: abbabab

Input: abaabaaaab

Output: abaabaaaab

Input: aaaab

Output: aaaab

Input: b

Output: b

Input: abbaabb

Output: abbaabb

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('baa') == 'baa'
        >>> apply_pipeline('bbba') == 'bbba'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('baba') == 'baba'
        >>> apply_pipeline('aababa') == 'aababa'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('b') == 'b'
        >>> apply_pipeline('bbaab') == 'bbaab'
    """
    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('baa') == 'baa'
    assert candidate('bbba') == 'bbba'
    assert candidate('b') == 'b'
    assert candidate('baba') == 'baba'
    assert candidate('aababa') == 'aababa'
    assert candidate('b') == 'b'
    assert candidate('b') == 'b'
    assert candidate('bbaab') == 'bbaab'

    # hidden tests
    assert candidate('b') == 'b'
    assert candidate('a') == 'a'
    assert candidate('aabaaba') == 'aabaaba'
    assert candidate('bb') == 'bb'
    assert candidate('abababaa') == 'abababaa'
    assert candidate('bbbba') == 'bbbba'
    assert candidate('abaaabbaa') == 'abaaabbaa'
    assert candidate('aaa') == 'aaa'
    assert candidate('aaba') == 'aaba'
    assert candidate('aba') == 'aba'
    assert candidate('ababaab') == 'ababaab'
    assert candidate('aabba') == 'aabba'
    assert candidate('abb') == 'abb'
    assert candidate('baaabab') == 'baaabab'
    assert candidate('aaabbab') == 'aaabbab'
    assert candidate('baab') == 'baab'
    assert candidate('baabaabbb') == 'baabaabbb'
    assert candidate('baabba') == 'baabba'
    assert candidate('aaaa') == 'aaaa'
    assert candidate('ababbbbb') == 'ababbbbb'
    assert candidate('bbaab') == 'bbaab'
    assert candidate('abbbabaab') == 'abbbabaab'
    assert candidate('a') == 'a'
    assert candidate('abbaaa') == 'abbaaa'
    assert candidate('bbabaa') == 'bbabaa'
    assert candidate('bbbabab') == 'bbbabab'
    assert candidate('bbbaaabbab') == 'bbbaaabbab'
    assert candidate('aaabbb') == 'aaabbb'
    assert candidate('abab') == 'abab'
    assert candidate('baab') == 'baab'
    assert candidate('ba') == 'ba'
    assert candidate('aaaab') == 'aaaab'

Input: baa

Output: baa

Input: bbba

Output: bbba

Input: b

Output: b

Input: baba

Output: baba

Input: aababa

Output: aababa

Input: b

Output: b

Input: b

Output: b

Input: bbaab

Output: bbaab

Input: b

Output: b

Input: a

Output: a

Input: aabaaba

Output: aabaaba

Input: bb

Output: bb

Input: abababaa

Output: abababaa

Input: bbbba

Output: bbbba

Input: abaaabbaa

Output: abaaabbaa

Input: aaa

Output: aaa

Input: aaba

Output: aaba

Input: aba

Output: aba

Input: ababaab

Output: ababaab

Input: aabba

Output: aabba

Input: abb

Output: abb

Input: baaabab

Output: baaabab

Input: aaabbab

Output: aaabbab

Input: baab

Output: baab

Input: baabaabbb

Output: baabaabbb

Input: baabba

Output: baabba

Input: aaaa

Output: aaaa

Input: ababbbbb

Output: ababbbbb

Input: bbaab

Output: bbaab

Input: abbbabaab

Output: abbbabaab

Input: a

Output: a

Input: abbaaa

Output: abbaaa

Input: bbabaa

Output: bbabaa

Input: bbbabab

Output: bbbabab

Input: bbbaaabbab

Output: bbbaaabbab

Input: aaabbb

Output: aaabbb

Input: abab

Output: abab

Input: baab

Output: baab

Input: ba

Output: ba

Input: aaaab

Output: aaaab