Problem
问题
Loglan is a synthetic speakable language designed to test some of the fundamental problems of linguistics, such as the Sapir Whorf hypothesis. It is syntactically unambiguous, culturally neutral and metaphysically parsimonious. What follows is a gross over-simplification of an already very small grammar of some 200 rules.
Loglan是一种综合型可发音的语言,设计它是用来验证语言学上的一些原则性问题,比如萨皮尔—沃尔夫假说。它的句法精确明了,在文化上趋于中立,它的哲学是能省则省。该语言的语法集已经被过份的简化——只有200条语法规则。
Loglan sentences consist of a series of words and names, separated by spaces, and are terminated by a period (.). Loglan words all end with a vowel; names, which are derived extra-linguistically, end with a consonant. Loglan words are divided into two classes--little words which specify the structure of a sentence, and predicates which have the form CCVCV or CVCCV where C represents a consonant and V represents a vowel (see examples later).
Loglan的语句由一系列的单词和名称组成,中间由空格隔开,并由一个点号(.)表示结束。Loglan的单词均以元音结束;名称来自于该语言之外,由辅音结束。Loglan的单词分为两类——小单词和谓词。小单词指定了句子的结构;谓词的形式为“CCVCV”或“CVCCV”,其中C代表一个辅音,V代表一个元音。(见下面的例子)
The subset of Loglan that we are considering uses the following grammar:
我们考虑使用Loglan语言的一个子集,具有以下语法定义:
A → a | e | i | o | u
MOD → ga | ge | gi | go | gu
BA → ba | be | bi | bo | bu
DA → da | de | di | do | du
LA → la | le | li | lo | lu
NAM → {all names}
PREDA → {all predicates}
<sentence> → <statement> | <predclaim>
<predclaim> → <predname> BA <preds> | DA <preds>
<preds> → <predstring> | <preds> A <predstring>
<predname> → LA <predstring> | NAM
<predstring> → PREDA | <predstring> PREDA
<statement> → <predname> <verbpred> <predname> | <predname> <verbpred>
<verbpred> → MOD <predstring>
Write a program that will read a succession of strings and determine whether or not they are correctly formed Loglan sentences.
写一个程序,读入一组字符串并确定它们是不是正确的Loglan语句。
Input and Output
输入与输出
Each Loglan sentence will start on a new line and will be terminated by a period (.). The sentence may occupy more than one line and words may be separated by more than one whitespace character. The input will be terminated by a line containing a single `#'. You can assume that all words will be correctly formed.
每个Loglan语句均从新的一行开始,并以句点(.)结束。一条语句可能占用多行,且单词之间可能会多于一个空格。所有的输入由一个独占一行的#号表示结束。你可以认为所有单词的格式都是正确的。
Output will consist of one line for each sentence containing either 'Good' or 'Bad!'.
对于每一个输入的语句,应输出"Good"或"Bad!"。
Sample input
输入示例
la mutce bunbo mrenu bi ditca.
la fumna bi le mrenu.
djan ga vedma le negro ketpi.
#
Sample output
输出示例
Good
Bad!
Good