DCP-29: Common String Back to All Problems

Beginner Beginners Problems > Ad-hoc


In this problem you have to find the largest common string from two given string. Common substring in two strings is the common part that is present in both of them. But in a pair of string there can be many such parts. But you need to find the largest such common part and need to print the size of this part. abbaaa bbaaab In the above two strings, there are several common parts, but the largest part is bbaaa. So the output of these two will be 5. For this problem we will consider input will only have lower case English letters and there will be no space in the strings themselves. But the two strings will be separated by a single space. Input: ------ First line of the input will consist of an integer which represent the test case **T (0 < T <= 30)**. Each test case contains 2 strings separated by a space. You can assume both of these strings will be less than or equal to 100 character in length and they will only contain English lower case letters. Output: ------- For each test case first print the test case number as “**Case X: Y**” where **X** is the test case number and **Y** is an integer denoting the length of the maximum common sub-string. Sample Input ------------ 3 aaaaaa aba mizan ia tomy my Sample Output ------------- Case 1: 1 Case 2: 1 Case 3: 2


Problem Setter:

MD. Jalal Uddin

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C/C++ 1.00
Java 2.00
C# 2.00
PHP 2.00

Problem Stats

35/105

Solve/Submission

Ranking

# User Language Timing
01 joy25896 Cpp 0.00s
02 rifat_cse Cpp 0.00s
03 ishrafislam2727 Cpp 0.00s
04 maxhasan Cpp 0.00s
05 gazi93 Cpp 0.00s
06 badhansen123 Cpp 0.00s
07 terminator_c Cpp 0.00s
08 SakibAlamin Cpp 0.00s
09 Ashish972 Cpp 0.00s
10 gulzar Cpp 0.00s
11 seyedssz Cpp 0.00s
12 Nazmul0092 Cpp 0.00s
13 bengal_tiger Cpp 0.00s
14 sadia2427 Cpp 0.00s
15 haasib Cpp 0.01s
16 Indro_BU Cpp 0.01s
17 rezaul_karim Cpp 0.07s
18 marineCoder Cpp 0.08s
19 anwar3606 Cpp 0.18s
20 rayhan50001 Cpp 0.23s
21 ArifKhanShubro Cpp 0.25s
22 tariqiitju Cpp 0.40s
23 dip_BRUR Cpp 0.40s
24 rana_cse Cpp 0.49s
25 7Mahfuz Cpp 0.50s
26 mdtameemkhan Cpp 0.50s
27 anowar1112 Cpp 0.50s
28 njrafi Cpp 0.51s
29 Roll_Number_27 Cpp 0.57s
30 masumkhan Java 1.99s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support