1706. Parsing Real Numbers

单点时限: 2.0 sec

内存限制: 256 MB

Write a program that read a line of input and checks if the line contains a valid real number. Real numbers may have a decimal point, an exponent (starting with the character e or E), or both. Additionally, it has the usual collection of decimal digits. If there is a decimal point, there must be at least one digit on each side of the point. There may be a plus or minus sign in front of the number, or the exponent, or both (without any blank characters after the sign). Exponents are integers (not having decimal points). There may be blank characters before or after a number, but not inside it. Note that there is no bound on the range of the numbers in the input, but for the sake of simplicity, you may assume the input strings are not longer than 1000 characters.

输入格式

The first line of the input contains a single integer T which is the number of test cases, followed by T lines each containing the input line for a test case.

输出格式

The output contains T lines, each having a string which is LEGAL or ILLEGAL.

样例

Input
2
1.5e+2
3.
Output
LEGAL
ILLEGAL

5 人解决,14 人已尝试。

5 份提交通过,共有 20 份提交。

8.2 EMB 奖励。

创建: 17 年,3 月前.

修改: 7 年,3 月前.

最后提交: 1 年,5 月前.

来源: Tehran 2006 Preliminary

题目标签