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




# 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 Dragon_162 Cpp 0.00s
09 Ashish972 Cpp 0.00s
10 gulzar Cpp 0.00s
11 seyedssz Cpp 0.00s
12 Nazmul0092 Cpp 0.00s
13 emrul Cpp 0.00s
14 mahbub07 Cpp 0.00s
15 Dinar Cpp 0.00s
16 AlaminJust Cpp 0.00s
17 Saimum_140128 Cpp 0.00s
18 smriad Cpp 0.00s
19 bengal_tiger Cpp 0.00s
20 sadia2427 Cpp 0.00s
21 haasib Cpp 0.01s
22 Indro_BU Cpp 0.01s
23 rezaul_karim Cpp 0.07s
24 marineCoder Cpp 0.08s
25 anwar3606 Cpp 0.18s
26 rayhan50001 Cpp 0.23s
27 ArifKhanShubro Cpp 0.25s
28 tariqiitju Cpp 0.40s
29 dip_BRUR Cpp 0.40s
30 rana_cse Cpp 0.49s
31 7Mahfuz Cpp 0.50s
32 mdtameemkhan Cpp 0.50s
33 anowar1112 Cpp 0.50s
34 njrafi Cpp 0.51s
35 Roll_Number_27 Cpp 0.57s
36 masumkhan Java 1.99s

Your feedback is our precious!

Or call +88 02 9853138 for support