## TLE '16 Contest 8 P1 - Paper Hole Punching

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Hole punched paper in a 3-ring binder! An upgrade over stapled paper!

Nathan is a competitor in the Canadian Computing Olympiad (CCO). To prepare for this difficult competition, he will bring a thick binder full of code samples (even though the CCO disallows paper notes).

Nathan begins by categorizing the pages according to the holes that appear. The rules are stated below:

• A category is a string with a length between and .
• The first letter of the string is -.
• The possible hole locations on the page are labelled from A to F. When a page has a hole, its corresponding letter is in the string.
• The letters in the string will appear in sorted order.

For example, the category -ABF represents a page with holes at A, B, and F. The category -ABCDEF represents a page with holes at all locations.

Nathan's binder is slightly unusual. Since he has a massive number of pages, he needs certain holes in certain locations. The page template contains all of the holes needed for his pages. Nathan absolutely cannot rotate/flip over any page and put it into the binder, since he needs the extra few seconds to boost his ranking.

Nathan will put pages into his binder. Can you tell him whether each page will fit or not?

#### Input Specification

The first line contains , the page template.

The second line contains .

The next lines contain a category. Nathan has a page in this category, and he wants to put it into the binder.

#### Output Specification

For each of the pages, print yes or no on its own line. Print yes if the page can fit into the binder. Print no if additional holes need to be punched.

#### Sample Input

-ABC
4
-AB
-ABC
-ABCDEF
-DEF

#### Sample Output

no
yes
yes
no

#### Explanation for Sample Output

From the template , there must be holes at A, B, and C for a page to fit into a binder.

The first page is missing hole C, so the output is no.
The second and third pages have the necessary holes, so the output is yes.
The fourth page does not have any of the holes, so the output is no.