Problem · String
Palindrome Word
Learn this problemProblem statement
A palindrome is a sequence that reads the same forwards as it does backwards. "azbza", for example, is a palindrome, with the palindrome "zbz" nested within it. Your function will accept a string of characters as a parameter and return every occurrence of a palindromic substring with at least 3 characters. Results are case-sensitive and ordered by increasing start index; when multiple palindromes start at the same index, return the longer one first. Duplicate values are retained when they occur at different positions. For example, if the string is "aCacfzFccFzq", the function returns:
aCa
zFccFz
FccF
Note that the function does not return "Cac", "fzF", or "cfzFc" because of case-sensitivity.
Function
printAllPalindromes(s: String) → String[]Examples
Example 1
s = "aCacfzFccFzq"return = ["aCa", "zFccFz", "FccF"]The function returns all palindromes of 3 or more characters in length contained in "aCacfzFccFzq". The matching case-sensitive substrings are "aCa", "zFccFz", and the nested palindrome "FccF".