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 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats




# User Language Timing
01 joy25896 Cpp14 0.00s
02 rifat_cse Cpp14 0.00s
03 maxhasan Cpp14 0.00s
04 gazi93 Cpp14 0.00s
05 badhansen123 Cpp14 0.00s
06 terminator_c Cpp14 0.00s
07 Dragon_162 Cpp14 0.00s
08 Ashish972 Cpp14 0.00s
09 gulzar Cpp14 0.00s
10 seyedssz Cpp14 0.00s
11 Nazmul0092 Cpp14 0.00s
12 emrul Cpp14 0.00s
13 mahbub07 Cpp14 0.00s
14 Dinar Cpp14 0.00s
15 AlaminJust Cpp14 0.00s
16 Saimum_140128 Cpp14 0.00s
17 smriad Cpp14 0.00s
18 afzalul Cpp14 0.00s
19 lolcoder Cpp14 0.00s
20 tasnuva1604087 Cpp14 0.00s
21 mrinmoi Cpp14 0.00s
22 lightlessShadO Cpp14 0.00s
23 bengal_tiger Cpp14 0.00s
24 sadia2427 Cpp14 0.00s
25 pulak_ict_mbstu Cpp14 0.00s
26 joymollick Cpp 0.00s
27 asif04 Cpp 0.00s
28 subhashis_cse Cpp 0.00s
29 nazmul_bzs Cpp14 0.01s
30 sumaiya710 Cpp14 0.01s
31 haasib Cpp14 0.01s
32 Indro_BU Cpp14 0.01s
33 Tania PHP 0.02s
34 mhsjaber CSharp 0.02s
35 DynamicOvi Cpp 0.05s
36 rezaul_karim Cpp14 0.07s
37 marineCoder Cpp14 0.08s
38 anwar3606 Cpp14 0.18s
39 rayhan50001 Cpp14 0.23s
40 ArifKhanShubro Cpp14 0.25s
41 tariqiitju Cpp14 0.40s
42 dip_BRUR Cpp14 0.40s
43 rana_cse Cpp14 0.49s
44 7Mahfuz Cpp14 0.50s
45 mdtameemkhan Cpp14 0.50s
46 anowar1112 Cpp14 0.50s
47 njrafi Cpp14 0.51s
48 mti_rocky Java 0.52s
49 Roll_Number_27 Cpp14 0.57s
50 masumkhan Java 1.99s

Your feedback is our precious!

Or call +88 02 9853138 for support