Your university recently established the Graduate Code Plagiarism Control (GCPC) initiative to get hold of the ever-increasing load on the graders for the computer science assignments. Currently, the graders need to check the code of assignments manually for plagiarism. The GCPC aims to simplify this part of the graders' jobs by performing the plagiarism checks automatically.
Code consists of tokens separated by spaces. Tokens are strings of alphabetical letters, numerals, and brackets. If a token consists of only a single alphabetical letter (upper or lowercase), it is a variable in the code.
The GCPC wants the plagiarism checker to compare query pieces of code to a reference code. Specifically, it should check whether each query could have been obtained by selecting a contiguous string of tokens from the reference and consistently renaming variables. Variables are consistently renamed if no two occurrences of the same variable are renamed to different variables, and if no two different variables are renamed to the same variable.
The GCPC has asked you to develop the plagiarism checker.
The input consists of:
For each query, output "yes" if the query could have been obtained from the reference, and "no" otherwise.
9for i in range(10) do print i j end43print j i2do print6k in range(10) do print k6k in range(10) do print j
yes yes yes no
5i is i times j75i is i times j5a is a times b5j is j times c5a is i times j5j is i times j50 is 0 times j5i is i times i
yes yes yes no no no no
5A 1 ( ) b42b 22b 131 ) (5a 1 ( ) F
no yes no yes
| Название |
|---|


