#K37492. Uppercase Transformation Verification
Uppercase Transformation Verification
Uppercase Transformation Verification
You are given a string s of length n and an integer k representing the number of stages of operations. At each stage, a list of indices is provided. For each index in the list, the character at that index in the string (using 1-indexing) is converted to its uppercase form.
Your task is to determine if, after performing all k stages, the entire string becomes uppercase. Formally, after processing, check if for all characters c in the string, it holds that \[ c \;\text{is uppercase} \;\forall c \in s. \]
If the condition is met, print YES
; otherwise, print NO
.
inputFormat
The input is read from standard input and has the following format:
- The first line contains two space-separated integers:
n
(the length of the string) andk
(the number of stages). - The second line contains the string
s
. - The following
k
lines describe each stage. Each stage is given on a single line that starts with an integerm
indicating the number of indices in that stage, followed bym
space-separated integers representing the indices to convert to uppercase.
outputFormat
Output a single line to standard output containing either YES
if the string becomes fully uppercase after performing all operations, or NO
otherwise.
5 3
hello
2 1 2
2 3 4
1 5
YES