#!/usr/bin/env python3

import subprocess

# Test with increasing lengths
for length in range(0, 50, 5):
    test_input = "a" * length
    result = subprocess.run(
        ["python", "baby.py"],
        input=test_input,
        capture_output=True,
        text=True,
        timeout=2
    )
    output = result.stdout + result.stderr
    has_not = "not the flag" in output
    print(f"len={length:2d}: {'FAIL' if has_not else 'PASS'} (output_len={len(output):5d})")

# Now test around 30-40
for length in range(30, 41):
    test_input = "a" * length
    result = subprocess.run(
        ["python", "baby.py"],
        input=test_input,
        capture_output=True,
        text=True,
        timeout=2
    )
    output = result.stdout + result.stderr
    has_not = "not the flag" in output
    print(f"len={length:2d}: {'FAIL' if has_not else 'PASS'}")
