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 abinash Cpp 0.00s
02 siamcr7 Cpp 0.00s
03 sahedsohel Cpp 0.00s
04 mizan Cpp 0.00s
05 KNUTH Cpp 0.00s
06 Hawk Cpp 0.00s
07 Double_O Cpp 0.00s
08 Zeronfinity Cpp 0.00s
09 duronto20 Cpp 0.00s
10 sdpsarker88 Cpp 0.00s
11 I_See_You Cpp 0.00s
12 ssavi Cpp 0.00s
13 subhashis_cse Cpp 0.00s
14 badhansen123 Cpp 0.00s
15 CLown1331 Cpp14 0.00s
16 Nazmul_WUB Cpp 0.00s
17 Trusted_Frustrated Cpp 0.00s
18 Optimus_primeV2 Cpp 0.00s
19 Foysol_Ahmed Cpp 0.00s
20 tariqiitju Cpp 0.00s
21 sazal_dev Cpp 0.00s
22 Najat Cpp 0.00s
23 arabin C 0.00s
24 shishir09 Cpp14 0.00s
25 prodipdatta7 Cpp 0.00s
26 Bruteforceman Cpp 0.00s
27 adamantium Cpp 0.00s
28 Mohaimin66 Cpp 0.00s
29 mjtbasif Cpp 0.00s
30 fearless_hasan Cpp 0.00s
31 sohag_AUST Cpp 0.00s
32 mahbub07 Cpp 0.00s
33 motaleb_ICT Cpp 0.00s
34 moshiur_cse15 Cpp14 0.00s
35 ashraful_afruz Cpp 0.00s
36 _GhOstMan_ Cpp 0.00s
37 sady_aust Cpp 0.00s
38 Tanvirh Cpp 0.00s
39 srijonsbzsifat Cpp 0.00s
40 feodorv C 0.00s
41 AlaminJust Cpp 0.00s
42 drifter Cpp 0.00s
43 jualahmed Cpp 0.00s
44 incognito_ju Cpp 0.00s
45 Not_Found0001 Cpp 0.00s
46 mir003 Cpp 0.00s
47 ovis96 Cpp14 0.00s
48 tajri Cpp 0.00s
49 Ishraq_Nibir Cpp 0.00s
50 monir769 Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support