Description

Given a string s, return true if the s can be palindrome after deleting at most one character from it.

Examples

Input:s = "aba"
Output:true
Explanation:

Already a palindrome.

Input:s = "abca"
Output:true
Explanation:

Delete 'c' to get 'aba'.

Input:s = "abc"
Output:false
Explanation:

Removing any single character gives 'ab', 'ac', or 'bc', none of which are palindromes.

Constraints

  • 1 ≤ s.length ≤ 10⁵
  • s consists of lowercase English letters.

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!