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 SakibAlamin Cpp 0.00s
09 Ashish972 Cpp 0.00s
10 bengal_tiger Cpp 0.00s
11 sadia2427 Cpp 0.00s
12 haasib Cpp 0.01s
13 Indro_BU Cpp 0.01s
14 rezaul_karim Cpp 0.07s
15 marineCoder Cpp 0.08s
16 anwar3606 Cpp 0.18s
17 rayhan50001 Cpp 0.23s
18 ArifKhanShubro Cpp 0.25s
19 tariqiitju Cpp 0.40s
20 dip_BRUR Cpp 0.40s
21 rana_cse Cpp 0.49s
22 7Mahfuz Cpp 0.50s
23 mdtameemkhan Cpp 0.50s
24 anowar1112 Cpp 0.50s
25 njrafi Cpp 0.51s
26 Zexon Cpp 0.57s
27 masumkhan Java 1.99s

Your feedback is our precious!

Or call +88 02 9853138 for support