{"raw_statement":[{"iden":"statement","content":"A string s is given. Also there is a string p, and initially it is empty. You need to perform q operations of kind «add a letter to the end of the string p» and «remove a letter from the end of the string p», and after performing each operation you must say whether or not s contains p as a subsequence.\n\nThe first line contains the string s of length from 1 to 200000, consisting of lowercase Latin letters.\n\nThe second line contains a single integer q (1 ≤ q ≤ 200000) — the number of operations.\n\nEach of the next q lines describes an operation in the format «_push c_», which means «add letter c to the end of the string p» (c is lowercase Latin letter), or «_pop_», which means «remove letter from the end of the string p». The «_pop_» operations is guaranteed never to be applied to the empty string p.\n\nOutput q lines, each of which equals «_YES_» or «_NO_», depending on whether or not the string p is contained in the string s as a subsequence after performing the corresponding operation.\n\n"},{"iden":"input","content":"The first line contains the string s of length from 1 to 200000, consisting of lowercase Latin letters.The second line contains a single integer q (1 ≤ q ≤ 200000) — the number of operations.Each of the next q lines describes an operation in the format «_push c_», which means «add letter c to the end of the string p» (c is lowercase Latin letter), or «_pop_», which means «remove letter from the end of the string p». The «_pop_» operations is guaranteed never to be applied to the empty string p."},{"iden":"output","content":"Output q lines, each of which equals «_YES_» or «_NO_», depending on whether or not the string p is contained in the string s as a subsequence after performing the corresponding operation."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ s \\in \\Sigma^* $ be a fixed string of length $ n $, where $ \\Sigma $ is the set of lowercase Latin letters.  \nLet $ p \\in \\Sigma^* $ be a dynamic string, initially empty.  \nLet $ Q = (o_1, o_2, \\dots, o_q) $ be a sequence of $ q $ operations, where each $ o_i \\in \\{ \\texttt{push}(c), \\texttt{pop} \\} $, $ c \\in \\Sigma $.  \n\n**Constraints**  \n1. $ 1 \\leq |s| \\leq 200000 $  \n2. $ 1 \\leq q \\leq 200000 $  \n3. Each `pop` operation is applied only when $ p \\neq \\varepsilon $.  \n4. All characters in $ s $ and operations are lowercase Latin letters.  \n\n**Objective**  \nAfter each operation $ o_i $, update $ p $ accordingly and determine whether $ p $ is a subsequence of $ s $.  \nOutput \"YES\" if $ p \\sqsubseteq s $, otherwise \"NO\".  \n\nFormally, for each $ i \\in \\{1, \\dots, q\\} $:  \n- If $ o_i = \\texttt{push}(c) $, then $ p \\leftarrow p \\cdot c $  \n- If $ o_i = \\texttt{pop} $, then $ p \\leftarrow p[1..|p|-1] $  \nThen output $ \\texttt{YES} $ if $ p $ is a subsequence of $ s $, else $ \\texttt{NO} $.","simple_statement":"You are given a string s and an empty string p.  \nYou perform q operations: either add a letter to the end of p, or remove the last letter from p.  \nAfter each operation, check if p is a subsequence of s.  \nPrint \"YES\" if it is, \"NO\" otherwise.","has_page_source":false}