#K6756. Dynamic Palindrome Checker
Dynamic Palindrome Checker
Dynamic Palindrome Checker
You are given an initial string and a series of operations. In each operation, you have to insert a given character at a specified position in the string and then check if the updated string forms a palindrome.
A palindrome is a string that reads the same backwards as forwards (e.g. \(abba\) is a palindrome while \(abc\) is not). Positions are 1-indexed.
After each operation, print "YES" if the string is a palindrome, otherwise print "NO". Each result should be printed on a new line.
inputFormat
The input begins with a string \(s\) followed by an integer \(q\), which represents the number of operations. This is followed by \(q\) pairs. Each pair contains a character and an integer representing the position where the character is to be inserted.
All tokens are space-separated and the input is read from standard input (stdin).
outputFormat
For each operation, output "YES" if the current string is a palindrome after the insertion, otherwise output "NO". Each answer should appear on its own line in standard output (stdout).
## sampleaba 3 b 2 a 1 c 3
YES
NO
NO
</p>