Copy stdin → stdout with unbalanced words removed. A word is balanced if every character in it occurs exactly n times (some n); case is ignored. A word is any run of non-whitespace (so tock-tock is one word). Print kept words separated by a single space; keep line count.
Example: Gaga is balanced (g×2, a×2); gauge is not.
Python only; no external programs / subprocess. From COMP2041/9044 21T2 Final.