word of lowercase Latin letters. One edit replaces any single letter of the word with a different letter.
Return True if the word can be turned into a palindrome using **exactly one or exactly two** edits, and False otherwise.word='radiar' → True
Only the middle pair differs: "d" and "i". Change "i" to "d" and you get "raddar".
word='noon' → True
The word is already a palindrome, but at least one edit is required: change both "o"s to "e" and "neen" is still a palindrome.
word='abcxyz' → False
All three mirrored pairs differ and each needs its own change, so two edits are not enough.
word.length ≤ 10⁵word consists of lowercase Latin letters onlyword='radiar'
True
Run checks the first 3 tests in your browser. Submit checks all 142 tests on the server, hidden ones included.