-->
当前位置:首页 > 题库

PROGRAMMING:natural language

Luz5年前 (2021-05-10)题库457
After LOJ stopped running, the service provider deleted the website, so the test data of all topics were lost.
In order to save LOJ, LCR has to upload her own stored game data, but she has to listen to grammar lessons in the classroom before school. However, the Chinese teacher's lectures are like the endless flow of the Yangtze River, and LCR is very bored, so it comes up with a question:
>As we all know, modern English and Chinese are the languages of SVO (subject predicate object) structure. In addition, there are two common structures in English: VO and ov, while in Chinese, only ov has no VO structure. Generally, s and o are nominal structures, and V is verb structure.
>
>SVO, OV and VO are nominal structures and can be nested.
Now we know the part of speech of each word in several sentences (each sentence is a string composed of N and V, n means a noun word, V means a verb word). Please judge whether each sentence conforms to the structure of English and Chinese respectively.
The Chinese character string is defined as:
*The string n is qualified.
*Replacing any n in a legal string with NV or NVN, the resulting string is qualified.
That is: $$n - > (NV | NVN)$$
A string that conforms to the English structure is defined as follows:
*The string n is qualified.
*Replacing any n in a legal string with NV or NVN or VN, the resulting string is qualified.
That is: $$n - > (NV | NVN | VN)$$
###Input format:
In the first line, a positive integer, $$t $, represents the number of data groups.
Next, $$t $$line, each line has a non empty string, $$s $, which represents the string to be judged.
###Output format:
The output consists of $$t $$lines.
Each line successively outputs the integers $$a $$and $$B $$separated by two spaces.
If the string conforms to the English structure, $$a = 1 $$, otherwise $$a = 0 $$; If the string conforms to the Chinese structure, $$B = 1 $$, otherwise $$B = 0 $$.
###Input example:
```in
three
NNV
VNVN
NVNV
```
###Output example:
```out
0 0
1 0
1 1
```
###Data range:
For $$100 $$% data, the maximum string length is $$1 < = m < = 10 ^ 6, 1 < = T < = 10 $$< br > < br > < br > < br > < br > for $$100 $$% data


answer:If there is no answer, please comment