Your task in this problem is to identify legal Pascal real constants. Each line of the input data contains a candidate which you are to classify. For each line of the input, display your finding as illustrated in the example shown below. The input terminates with a line that contains only an asterisk in column one.
Sample solution, Java
Try the Java solution:
1.2 1. 1.0e-55 e-12 6.5E 1e-12 +4.1234567890E-99999 7.6e+12.5 99 *
1.2 is legal. 1. is illegal. 1.0e-55 is legal. e-12 is illegal. 6.5E is illegal. 1e-12 is legal. +4.1234567890E-99999 is legal. 7.6e+12.5 is illegal. 99 is illegal.
1.0 1e0 1E000000000000000004 1. .1 1e-5 1.e4 1e-5.1 1.1.1 1+e5 1e5+ 1.1e+9999999999999999999999999999 1111111111111111.111111111111111111111111e999999999999999999999999 1.2345678901234567890012345678901234567890 00000000000000012345678901234567890012345678901234567890.0 00000000000000012345678901234567890012345678901234567890 *
1.0 is legal. 1e0 is legal. 1E000000000000000004 is legal. 1. is illegal. .1 is illegal. 1e-5 is legal. 1.e4 is illegal. 1e-5.1 is illegal. 1.1.1 is illegal. 1+e5 is illegal. 1e5+ is illegal. 1.1e+9999999999999999999999999999 is legal. 1111111111111111.111111111111111111111111e999999999999999999999999 is legal. 1.2345678901234567890012345678901234567890 is legal. 00000000000000012345678901234567890012345678901234567890.0 is legal. 00000000000000012345678901234567890012345678901234567890 is illegal.