{"raw_statement":[{"iden":"statement","content":"It is well known that Russian is one of the hardest languages in the world. It is one of the only languages in which declension applies to nouns, adjectives, pronouns and numerals. If you know something about German and have heard of its three complicated declensions, know that there are seven in Russian. Anyway, if you are up to a challenge, try to learn Russian.\n\nWhat is less known is that there is a Russian variant commonly spoken in Brazil. A Russian family immigrated into Italy in the XVII century. Later, in the wake of the XX century, they came to Brazil, where they live to this day, still preserving their culture and customs. This is the 'Russo' family. Of course, that is not their original surname, but they chose it when mister 'Pshenychnykh', after arriving at Calabria, gave up on trying to teach the Italians how to pronounce 'Pshenychnykh'. Only later he found out that 'Rosso' means red in Italian, but that just made him like the name even more.\n\nRusso's Russian dialect is a mix between Italian, Portuguese, Russian and Calabrian. Its grammar has one of the most complex phrases known to mankind. That became a problem when the descendants of mister Pshenychnykh had to study his finances. Fortunately, the family prospered in Brazil and got really rich. Unfortunately, that created a dispute among the descendants for the wealth and possessions linked to the family's name. Trying to settle things, they went after mister Pshenychnykh's financial notebooks.\n\nOf course, his notes are in the peculiar dialect spoken by the family. Moreover, it is known that mister Pshenychnykh always wrote things respecting the grammar of his dialect — he was really proud of his roots. A note is valid if it a possible expansion of _M_ in the following grammar:\n\nPrint \"YES\" if the line supplied is valid, and \"NO\" otherwise.\n\n"},{"iden":"output","content":"Print \"YES\" if the line supplied is valid, and \"NO\" otherwise."},{"iden":"examples","content":"Input1\nOutputYES\nInput: 1\nOutputNO\nInput$ | 2\nOutputYES\nInput5 : 14\nOutputYES\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ M $ be a formal grammar rule (unspecified). A string $ s $ is valid if $ s \\in L(M) $, where $ L(M) $ is the language generated by grammar $ M $.\n\n**Given**  \nA string $ s $ is provided as input.\n\n**Objective**  \nOutput \"YES\" if $ s \\in L(M) $; otherwise, output \"NO\".","simple_statement":"Check if the given string follows this grammar:  \nIt must be a valid expansion of _M_, where _M_ is defined by:  \n_M_ → \"M\" | \"M\" + _M_ | _M_ + \"M\"  \n\nPrint \"YES\" if valid, \"NO\" otherwise.","has_page_source":false}