LCC '21 Contest 5 J3 - Enigma 2.0

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

As an elite team of code crackers, you along with your comrades have been tasked with cracking the Enigma Too Bueno, the Antarctican cipher that has yet to be cracked. Through much inspection and investigation, your team has figured out some possible keywords that the Antarctican penguins may use. Your task is to perform frequency analysis for a particular keyword. In other words, you must find out the total number of times the keyword appears in a String S.

Constraints

1\le N\le 5\cdot10^4

1\le K\le N, 100

The given String S will only contain lowercase latin characters, uppercase latin characters, ,, ., or !.

The given keyword will only contain lowercase or uppercase latin characters.

Input Specification

The first line of input will contain two integers, N and K, the length of the full string and the length of the keyword.

The second line will contain a String, the full String in the problem.

The third line will contain a String, the keyword in the problem.

Output Specification

One integer, the number of times the keyword appears the String S.

Sample Input

15 3
Orz orz Azorzon
orz

Sample Output

2

Sample Explanation

The occurrences of "orz" (note the case sensitivity) are denoted in bold:

Orz orz Azorzon

Notes

The incorrect sample input has been fixed


Comments

There are no comments at the moment.