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 badhansen123 Cpp14 0.00s
02 subhashis_cse Cpp 0.00s
03 Saimum_140128 Cpp14 0.00s
04 Nazmul0092 Cpp14 0.00s
05 pusku Cpp 0.00s
06 emrul Cpp14 0.00s
07 rifat_cse Cpp14 0.00s
08 bengal_tiger Cpp14 0.00s
09 maxhasan Cpp14 0.00s
10 gazi93 Cpp14 0.00s
11 joy25896 Cpp14 0.00s
12 Dinar Cpp14 0.00s
13 pulak_ict_mbstu Cpp14 0.00s
14 mahbub07 Cpp14 0.00s
15 afzalul Cpp14 0.00s
16 mrinmoi Cpp14 0.00s
17 AlaminJust Cpp14 0.00s
18 gulzar Cpp14 0.00s
19 seyedssz Cpp14 0.00s
20 terminator_c Cpp14 0.00s
21 Ashish972 Cpp14 0.00s
22 Dragon_162 Cpp14 0.00s
23 lightlessShadO Cpp14 0.00s
24 smriad Cpp14 0.00s
25 lolcoder Cpp14 0.00s
26 sadia2427 Cpp14 0.00s
27 CSE1604084_Mahir Cpp14 0.00s
28 tasnuva1604087 Cpp14 0.00s
29 joymollick Cpp 0.00s
30 asif04 Cpp 0.00s
31 Morass Cpp14 0.00s
32 sumaiya710 Cpp14 0.01s
33 nazmul_bzs Cpp14 0.01s
34 Indro_BU Cpp14 0.01s
35 feodorv C 0.01s
36 haasib Cpp14 0.01s
37 Tania PHP 0.02s
38 mhsjaber CSharp 0.02s
39 RandyWaterhouse Python3 0.05s
40 DynamicOvi Cpp 0.05s
41 rezaul_karim Cpp14 0.07s
42 marineCoder Cpp14 0.08s
43 anwar3606 Cpp14 0.18s
44 rayhan50001 Cpp14 0.23s
45 ArifKhanShubro Cpp14 0.25s
46 dip_BRUR Cpp14 0.40s
47 tariqiitju Cpp14 0.40s
48 rana_cse Cpp14 0.49s
49 7Mahfuz Cpp14 0.50s
50 anowar1112 Cpp14 0.50s

Your feedback is our precious!

Or call +88 02 9853138 for support