DCP-445: Match counter Back to All Problems

Easy Beginners Problems > Ad-hoc


Today is the first day of new year 2018.So, brilliant boy **Mahammad** learned few string matching algorithms, Mahammad is now ready to practice. Today, his teacher gave him a simple task to solve. Teacher provided two strings of length **N** and **M**, respectively. Then, **Q** queries are followed, which asks to count the number of substrings of the first string of length L which are also substring of the second string. Note that, substring means a contiguous part of the string. Input: ------ Input starts with an integer **T (1 <= T <= 10)**, denoting the number of test cases. Each case starts with two integer **N ,M (1 ≤ N, M ≤ 45)** denoting the lengths of the two strings. The next two lines contain the first and second strings consisting only lowercase English letters, respectively. The forth line contains one integer **Q (1 ≤ Q ≤ 50)** indicating the number of queries which the teacher asks. The last **Q** lines, will have one positive integer **L (1 <= L <= 50)** each showing the the length of substrings which you need to process. Output: ------- For each of the queries, print the number of desired substrings. Sample Input ------------ 3 5 4 hello hell 4 1 2 3 4 6 6 peyser xeyyam 4 1 2 3 4 5 7 happy newyear 2 1 2 Sample Output ------------- 4 3 2 1 3 1 0 0 2 0 For the first query of the first test case "h", "e", "l", "l" satisfy the condition.


Problem Setter:

Mahmud Allahverdiyev

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 2.00
C++ 2.00
C++14 2.00
C# 3.00
Go 3.00
Java 3.00
JavaScript 3.00
Objective-C 3.00
Perl 3.00
PHP 3.00
Python 3.00
Python3 3.00
Ruby 3.00
VB.Net 3.00

Problem Stats

92/204

Solve/Submission

Ranking

# User Language Timing
01 swapnil Cpp 0.00s
02 pulak_ict_mbstu Cpp 0.00s
03 Sagor Cpp 0.00s
04 FariD Cpp14 0.00s
05 Indrjit_BU Cpp 0.00s
06 _GhOstMan_ Cpp 0.00s
07 Taran Cpp14 0.00s
08 feodorv C 0.00s
09 anik_JU Cpp 0.00s
10 AlaminJust Cpp 0.00s
11 nymphaea Cpp 0.00s
12 The_Musketeer Cpp14 0.00s
13 ss1230 Cpp 0.00s
14 mir003 Cpp 0.00s
15 unknown420 Cpp 0.00s
16 monir769 Cpp14 0.00s
17 mepromee Cpp 0.00s
18 abu_rifat Cpp 0.00s
19 lsiddiqsunny Cpp 0.00s
20 mehedi_01 Cpp14 0.00s
21 hmsayem Cpp14 0.00s
22 by_default Cpp 0.00s
23 Ryuuk Cpp 0.00s
24 soohotiam Cpp 0.00s
25 mahade31 Cpp14 0.00s
26 Riaz_BSMRSTU Cpp 0.01s
27 loser_123 Cpp14 0.01s
28 sazal24_7 Cpp 0.01s
29 daihan_mbstu Cpp 0.01s
30 RAJ0RSHI Cpp 0.01s
31 jayed_al_hasan Cpp 0.01s
32 Bruteforcekid Cpp14 0.01s
33 Silent_Warrior Cpp 0.01s
34 bu_hridoy Cpp 0.01s
35 Sajal_Deb Cpp 0.01s
36 Dhrubo020 Cpp 0.01s
37 njrafi Cpp 0.01s
38 cse_nazmul Cpp 0.01s
39 voongvang C 0.01s
40 m_arif Cpp 0.01s
41 sdpsarker88 Cpp14 0.01s
42 mhiceiuk Cpp 0.01s
43 showmic Cpp14 0.01s
44 emrul Cpp14 0.01s
45 Foysol_Ahmed Cpp 0.01s
46 pin2paul Cpp 0.01s
47 tariqiitju Cpp14 0.01s
48 Biprodas Cpp14 0.01s
49 Mr_adnan Cpp 0.01s
50 orpib Cpp 0.01s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support