FastPrepFastPrep
Problem Brief

Palindrome Word

OA

A palindrome is a sequence that reads the same forwards as it does backwards. "abba", for example, is a palindrome, with the palindrome "bb" nested within it. Your function will accept a string of characters as a parameter and will print all palindromes of 3 or more characters in length contained in the string. All palindromes should be case-sensitive. For example, if the string is "abcdefccfed", the function will print:

cdefc

fccf

ccf

Note that the function will not print "cac", "fcf", or "cfcfc" because of case-sensitivity.

1Example 1

Input
s = "abcdefccfed"
Output
cdefc fccf ccf
Explanation
The function prints all palindromes of 3 or more characters in length contained in the string "abcdefccfed", which are case-sensitive. The palindromes "cdefc", "fccf", and "ccf" are found and printed, while others like "cac", "fcf", or "cfcfc" are not printed due to case-sensitivity.
public void printAllPalindromes(String s) {
  // write your code here
}
Input

s

"abcdefccfed"

Output

"cdefc fccf ccf"

Sign in to submit your solution.