Menu
Question Index
...


Write a program to print all palindromes present in the given string. Please note that the output should be first ordered by the number of characters in the string. Smaller palindromes should be shown first.

Input (String) Printed Output
MERITITEMME M E R I T I T E M M E MM ITI TIT EMME
SCAJAVAAVAJAVS S C A J A V A A V A J A V S AA AJA AVA AVA AJA VAAV VAJAV AVAAVA JAVAAVAJ AJAVAAVAJA
HARDDRAARDD H A R D D R A A R D D DD AA DD RDDR RAAR ARDDRA DRAARD DDRAARDD
PRINTTNIPRI P R I N T T N I P R I TT NTTN INTTNI
LIRIL L I R I L IRI LIRIL

class PrintAllPossiblePalindromes

{    public static void main(String s[])
    {
        String input = "MERITITEMME";
        getPalindromes(input);

    }


public static void getPalindromes(String input) {
//Write code here to print all possible palindromes.
}

//If required, write any additional methods here
}

Doubts

Problems

Topic: Java String substring() method - substring In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App