Write a program that reads a line of input and checks whether it contains a valid real number. A real number may contain a decimal point, an exponent (starting with the character e or E), or both. Additionally, a real number may consist only 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 at the beginning of the number, before the exponent, or both (with no spaces after the sign). The exponent must be an integer (it cannot have a decimal point). Spaces may appear before or after the number, but not within it. Note that there is no bound on the range of the numbers in the input, but for simplicity, you may assume the input strings contain no more than characters.
The first line contains an integer , the number of test cases. The following lines each contain an input string.
Output lines. Each line should contain the string LEGAL or ILLEGAL.
Ejemplo 1