I Have Few Friends (Small)
InterviewTime limit1sMemory limit128 MB
A textbook text S may contain digits that stand for unknown letters. Decide whether a keyword K (letters only) can match some substring of S, treating each digit as any letter.
- Level
Easy3 of 10
- Topics
- String, Brute force, Implementation
- Solved
- No attempts yet
Problem
Sungmin has few friends, so even when he missed class he could not get proper information about exams or assignments. He had been barely keeping his number of absences from putting him at risk of an F, and then one day, without any explanation, he was made to take a pop quiz!
Caught off guard by the sudden quiz, Sungmin decides to cram using a magic eye.
The textbook for the course Sungmin is taking consists only of lowercase letters (a-z) and uppercase letters (A-Z). The keyword Sungmin wants to find in the textbook also consists only of lowercase and uppercase letters. But a big problem came up. While copying the notes for the classes he missed from a friend, he wrote digits (0-9) into the textbook.
Unable to find the keyword and in a panic, Sungmin asks you, one of his few friends, for help. Help Sungmin by telling him whether the keyword he wants to find exists in the textbook.
Input
The first line gives a string S consisting of lowercase letters, uppercase letters, and digits. (1 ≤ |S| ≤ 100) The second line gives the keyword string K, consisting only of lowercase and uppercase letters, that Sungmin wants to find. (1 ≤ |K| ≤ 100).
The length of the keyword string K in the input is less than or equal to the length of the textbook string S.
Output
On the first line, print 1 if the keyword Sungmin wants to find exists in the string, and 0 if it does not.