OlveraeUNSW
返回题目列表
COMP2041

21T2 Q10 — 删除不平衡的词

把 stdin 复制到 stdout,但删除不平衡的词。词平衡指其中每个字符恰好出现 n 次(某个 n);忽略大小写。词是任意非空白串(故 tock-tock 是一个词)。保留的词用单个空格分隔;保持行数。

例:Gaga 平衡(g×2, a×2);gauge 不平衡。


Python only; no external programs / subprocess. From COMP2041/9044 21T2 Final.

样例

stdin
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I --
I took the one less traveled by,
And that has made all the difference.
期望输出
I be this with a sigh
ages and ages
Two roads in a and I --
I the one by,
And has made the
python3
14