Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given a substring of length ~ n ~. Find a way to replace at most ~2~ characters to obtain a palindrome.
Input
- Includes ~ T ~ test cases (~ T \leq 10^3 ~), each test case is on a separate line:
- Each line contains a string ~ s ~ (~ |s| \leq 10^3 ~).
Output
- Print ~ T ~ lines, each line is
YES
if there is a way to achieve the above requirement, orNO
if there is no such way.
Sample Input
zcxxxc
xxczxx
zxcvbn
Sample Output
YES
YES
NO
Note
- zcxxxc → ccxxcc
- xxczxx → xxccxx
- Cannot replace.
Bình luận