P8185 [USACO22FEB] Blocks B

题目描述

为了提高词汇量,母牛贝西得到了一套四块木块,其中每块都是一个立方体,六面各写着一个字母。她正在通过将木块排成一排使得木块顶部的字母拼出单词来学习拼写。 给定 Bessie 的四个木块上的字母,以及她想拼写的单词列表,请确定列表中哪些单词可被她使用木块成功拼写。

输入格式

输出格式

说明/提示

【样例解释】 In this example, Bessie can spell COW, ZOO, and MOVE. Sadly, she cannot spell MOO, since the only block with an M cannot also be used for an O. She cannot spell FARM since there is no block with a letter R. She cannot spell CODE since the C, D, and E all belong to the same block.