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 siamcr7 Cpp 0.00s
16 drifter Cpp 0.00s
17 DynamicOvi Cpp 0.00s
18 last Cpp 0.00s
19 abinash Cpp 0.00s
20 Najat Cpp 0.00s
21 SakibAlamin Cpp14 0.00s
22 Optimus_primeV2 Cpp 0.00s
23 mir003 Cpp 0.00s
24 moshiur_cse15 Cpp14 0.00s
25 motaleb_ICT Cpp 0.00s
26 Mohaimin66 Cpp 0.00s
27 KNUTH Cpp 0.00s
28 prodipdatta7 Cpp 0.00s
29 fearless_hasan Cpp 0.00s
30 tlcakash Cpp 0.00s
31 Bruteforceman Cpp 0.00s
32 ____ Cpp 0.00s
33 Rev_2 Cpp 0.00s
34 incognito_ju Cpp 0.00s
35 Bisnu039 C 0.00s
36 trifiasco Cpp 0.00s
37 MU_Barun Cpp 0.00s
38 Ishraq_Nibir Cpp 0.00s
39 tajri Cpp 0.00s
40 asif04 Cpp 0.00s
41 srijonsbzsifat Cpp 0.00s
42 ashraful_afruz Cpp 0.00s
43 iammarajul C 0.00s
44 aaman007 Cpp 0.00s
45 indroneel Cpp 0.00s
46 Not_Found0001 Cpp 0.00s
47 sady_aust Cpp 0.00s
48 monir769 Cpp 0.00s
49 sahedsohel Cpp 0.00s
50 shishir09 Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support