#K12666. Valid Palindrome II

    ID: 23742 Type: Default 1000ms 256MiB

Valid Palindrome II

Valid Palindrome II

You are given a string ( s ). Your task is to determine if ( s ) can become a palindrome by deleting at most one character. A palindrome is a string that reads the same forward and backward. Note that you are allowed to delete at most one character to achieve this condition. For example, given the input string "abca", by deleting the character 'b' or 'c', the string becomes "aca", which is a palindrome.

Input Constraints:

  • The input consists of a single non-empty string \( s \) containing only printable characters.

Examples:

  • Input: abca → Output: True
  • Input: racecar → Output: True
  • Input: hello → Output: False

inputFormat

The input is read from standard input (stdin) as a single line containing the string ( s ).

outputFormat

Output to standard output (stdout) the string "True" if the input string ( s ) can be transformed into a palindrome by deleting at most one character; otherwise, output "False".## sample

abca
True

</p>