Back
Close

Lazy Lock

Statement

 Goal

You have a digital lock which can be opened typing a series of K digits from 0 - 9.
You can also type any digits before or after any member of the K digits,
the lock will open after typing each digit of K at least once in order.

Print yes or no whether the given T digits opens the lock.
Input
1rst line: string of K digits which opens the lock
2nd line: N number of trial series
next N lines: string of T digits to check
Output
N lines: yes or no depending on the given T digits opens the lock
Constraints
1 <= K, T, N <= 1000
Example
Input
12345
3
712304256
54321234
67890
Output
yes
no
no

Game modes
Fastest, Shortest

Test cases
example Test
Input
12345 3 712304256 54321234 67890
Output
yes no no

swap one pair Validator
Input
12345 4 12354 21345 12435 13245
Output
no no no no

shorter samples Test
Input
31542 4 3 31 315 3154
Output
no no no no

shorter samples - 2 Validator
Input
56789 4 6789 789 89 9
Output
no no no no

inserted digits into the key Test
Input
345678 3 333344555666677888 1314151617181 123450634768
Output
yes yes yes

partial key inserted into the key Validator
Input
3751 5 375375751 337573755371375 7513737531 1375371 3513731353175
Output
yes yes yes yes yes

repeated digits in the key Test
Input
20151021 5 2015102015 20150120152015 2015201520152015 201501210 347647374
Output
yes yes yes no no

key from the same digit Validator
Input
9999 6 9 99 9999 192939495 1929394 31285764
Output
no no yes yes no no

incorrect order Test
Input
24680 4 08642 1043682 80246 28640
Output
no no no no

random Validator
Input
2332 5 2332 232323 22323999 123123123123 9878798787878798776878729909809887878783098098908
Output
yes yes no yes no

Solution language

Solution

Stub generator input