当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2946:Letter Cookies

题目描述
Satre has finally decided to put their famous Letter Cookies back on market again. Of course they are just as interesting to play with as to eat. Your little sister is trying to make words out of the letters she found in the box, but you want to be faster than her to decide whether it is possible to make the word or not.


Given the letters in the cookie box, is it possible to spell out the words your little sister knows how to spell? (After creating a word, she scrambles the cookies again and can reuse the letters for later words.)
输入解释
The first line of the input consists of a single number T, the number of letter cookie boxes your sister has. Each test case starts with a line describing all the letters in this box, in no particular order. Then follows a line with W, the number of words she would like to spell, and then follow the W words to write on a single line each.
输出解释
For each word, output a line containing YES if it is possible to spell the word, or NO if it is not possible.



Notes and Constraints

0 < T <= 100

0 < W <= 100

All letters are uppercase letters from the english alphabet (A-Z).

There are at most 1000 letters in each cookie box.

Each word has at most 100 letters (but is not necessarily an actual English word).
输入样例
1
ABANANACOOKIE
4
BANANA
LETTER
COOKIES
CAN
输出样例
YES
NO
NO
YES
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 IDI Open 2009

源链接: HDU-2946

最后修改于 2020-10-25T22:58:31+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)