#K86287. Check Palindrome After Removals
Check Palindrome After Removals
Check Palindrome After Removals
You are given a string ( s ) and a list of indices. After removing the characters at these indices from ( s ), determine whether the resulting string is a palindrome. A string is considered a palindrome if it reads the same forwards and backwards.
For example, if ( s = \texttt{abacaba} ) and the indices to remove are ( k = [1, 5] ), then after removal, the string becomes ( \texttt{aacaa} ). If the modified string forms a palindrome, output "YES"; otherwise, output "NO".
inputFormat
The input consists of multiple lines. The first line contains the string ( s ). The second line contains an integer ( n ) denoting the number of indices to remove. The third line contains ( n ) space-separated integers representing the 0-indexed positions of the characters to remove from ( s ). It is guaranteed that all given indices are valid.
outputFormat
Output a single line containing "YES" if the resulting string is a palindrome; otherwise, output "NO".## sample
abacaba
2
1 5
YES
</p>