DCP-375: Smallest Palindromic Substring Back to All Problems

Easy Beginners Problems > Ad-hoc

A string is called **palindrome** if it reads same backward as well as forward.<br> For example, "madam", "level", "racecar" etc are palindrome.<br> You have given a string , say - **S**. Your task is to print the **smallest palindromic sub-string** in the given string.<br> If there are more than one solution, print the one which is **lexicographically largest**. Note: A word is lexicographically larger than another if it comes later in dictionary order. Input: ------ Input starts with an integer **T (1<=T<=1000)**, denoting the number of test cases. Each case contains a nonempty string - S consists of lowercase letters only, length of which do not exceeds 20. Output: ------- For each case of input, output the substring which is *smallest palindrome and lexicographically largest.* Sample Input ------------ 1 ab Sample Output ------------- b

Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 0.50
C++ 0.50
C++14 0.50
C# 0.50
Go 0.50
Java 0.50
JavaScript 0.50
Objective-C 0.50
Perl 0.50
PHP 0.50
Python 0.50
Python3 0.50
Ruby 0.50
VB.Net 0.50

Problem Stats




# User Language Timing
01 adamantium Cpp 0.00s
02 ovis96 Cpp14 0.00s
03 sdpsarker88 Cpp 0.00s
04 I_See_You Cpp 0.00s
05 CLown1331 Cpp14 0.00s
06 badhansen123 Cpp 0.00s
07 _GhOstMan_ Cpp 0.00s
08 Zeronfinity Cpp 0.00s
09 ssavi Cpp 0.00s
10 Double_O Cpp 0.00s
11 mahbub07 Cpp 0.00s
12 Hawk Cpp 0.00s
13 Foysol_Ahmed Cpp 0.00s
14 duronto20 Cpp 0.00s
15 DynamicOvi Cpp 0.00s
16 last Cpp 0.00s
17 abinash Cpp 0.00s
18 Najat Cpp 0.00s
19 siamcr7 Cpp 0.00s
20 SakibAlamin Cpp14 0.00s
21 mir003 Cpp 0.00s
22 moshiur_cse15 Cpp14 0.00s
23 motaleb_ICT Cpp 0.00s
24 Mohaimin66 Cpp 0.00s
25 KNUTH Cpp 0.00s
26 prodipdatta7 Cpp 0.00s
27 fearless_hasan Cpp 0.00s
28 Rev_2 Cpp 0.00s
29 incognito_ju Cpp 0.00s
30 tlcakash Cpp 0.00s
31 Bruteforceman Cpp 0.00s
32 ____ Cpp 0.00s
33 Bisnu039 C 0.00s
34 Optimus_primeV2 Cpp 0.00s
35 MU_Barun Cpp 0.00s
36 Ishraq_Nibir Cpp 0.00s
37 tajri Cpp 0.00s
38 asif04 Cpp 0.00s
39 srijonsbzsifat Cpp 0.00s
40 ashraful_afruz Cpp 0.00s
41 iammarajul C 0.00s
42 aaman007 Cpp 0.00s
43 indroneel Cpp 0.00s
44 Not_Found0001 Cpp 0.00s
45 sady_aust Cpp 0.00s
46 monir769 Cpp 0.00s
47 sahedsohel Cpp 0.00s
48 shishir09 Cpp 0.00s
49 Trusted_Frustrated Cpp 0.00s
50 feodorv C 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support