#K15166. Valid Palindrome with One Removal

    ID: 24297 Type: Default 1000ms 256MiB

Valid Palindrome with One Removal

Valid Palindrome with One Removal

You are given a string s. Determine whether it is possible to make s a palindrome by removing at most one character. In other words, you can remove zero or one character from s and check if the resulting string is a palindrome.

A palindrome is a string that reads the same forward and backward. For example, "racecar" is a palindrome, while "hello" is not.

Examples:

  • Input: "abca"; Output: True (remove the character 'c' to form "aba")
  • Input: "racecar"; Output: True (already a palindrome)
  • Input: "abcdef"; Output: False (cannot be made a palindrome by removing just one character)

Your solution must read input from stdin and output the answer to stdout.

inputFormat

The input consists of a single line containing a non-empty string s.

Note: The string may contain any printable characters.

outputFormat

Output a single boolean value: True if the string can be made into a palindrome by removing at most one character, and False otherwise.

## sample
abca
True

</p>