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 rezaul_karim Cpp 0.07s
09 marineCoder Cpp 0.08s
10 anwar3606 Cpp 0.18s
11 rayhan50001 Cpp 0.23s
12 ArifKhanShubro Cpp 0.25s
13 dip_BRUR Cpp 0.40s
14 tariqiitju Cpp 0.40s
15 rana_cse Cpp 0.49s
16 7Mahfuz Cpp 0.50s
17 mdtameemkhan Cpp 0.50s
18 anowar1112 Cpp 0.50s
19 njrafi Cpp 0.51s
20 Zexon Cpp 0.57s
21 masumkhan Java 1.99s

Your feedback is our precious!

Or call +88 02 9853138 for support