# Python's str operations as Vibe takes them (D188): capitalize, swapcase, title, the
# justifications, zfill, a literal template's format and `%`, a conversion with a format
# spec, ord and chr, and min, max and join of generators. Its output is CPython's.


def main() -> None:
    print("abc".capitalize(), "Ab".swapcase(), "title me now".title(), "x".zfill(3), "-7".zfill(4))
    print("hi".center(6, "*"), "hi".center(7), "x".ljust(3) + "|", "x".rjust(3, "."))
    print("{}-{}".format(1, "two"), "{0}{1}{0}".format("a", "b"))
    print("{:>5}|{!r}".format(42, "q"))
    x = 3
    name = "bo"
    print("%d items for %s" % (x, name), "%5.2f|%-4s|%03d|%r|%%" % (3.14159, "ab", 7, name))
    print(f"{x!r:>4}|{name!r:<6}|")
    print(ord("A"), chr(66), ord(chr(955)), chr(ord("a") + 1))
    xs: list[int] = [4, 9, 2]
    words: list[str] = ["a", "b", "c"]
    print(min(x * 2 for x in xs), max(x for x in xs if x < 9), "-".join(w.upper() for w in words))
    print(sorted(x % 5 for x in xs), list(w + w for w in words))


if __name__ == "__main__":
    main()
