import java.io.*;

public class Scanner
{
    private static final int LETTER = 0;
    private static final int DIGIT  = 1;
    private static final int PLUS   = 2;
    private static final int MINUS  = 3;
    private static final int DOT    = 4;
    private static final int E      = 5;
    private static final int OTHER  = 6;
    
    // State transition matrix (acceptance states < 0)
    private static final int matrix[][] = {
            
        /*        letter digit   +    -    .    E other */
        /*  0 */ {   1,    4,    3,   3,   0,   1,   0 },
        /*  1 */ {   1,    1,   -2,  -2,  -2,   1,  -2 },
        /*  2 */ {   0,    0,    0,   0,   0,   0,   0 },
        /*  3 */ {   0,    4,    0,   0,   0,   0,   0 },
        /*  4 */ {  -5,    4,   -5,  -5,   6,   9,  -5 },  
        /*  5 */ {   0,    0,    0,   0,   0,   0,   0 },
        /*  6 */ {   0,    7,    0,   0,   0,   0,   0 },
        /*  7 */ {  -8,    7,   -8,  -8,  -8,   9,  -8 },
        /*  8 */ {   0,    0,    0,   0,   0,   0,   0 },  
        /*  9 */ {   0,   11,   10,  10,   0,   0,   0 }, 
        /* 10 */ {   0,   11,    0,   0,   0,   0,   0 },
        /* 11 */ { -12,   11,  -12, -12, -12, -12, -12 },
        /* 12 */ {   0,    0,    0,   0,   0,   0,   0 },
    };
    
    private char ch;    // current input character
    private int state;  // current state
    
    private String nextToken()
        throws IOException
    {
        while (Character.isWhitespace(ch)) nextChar();
        if (ch == 0) return null;  // EOF?
        
        state = 0;  // start state
        StringBuilder buffer = new StringBuilder();
        
        while (state > 0) {   // not acceptance state
            state = matrix[state][typeOf(ch)];  // transit
            
            if (state > 0) {
                buffer.append(ch);  // build token string
                nextChar();
            }
        }
        
        return buffer.toString();
    }
    
    private void scan()
        throws IOException
    {
        nextChar();
        
        while (ch != 0) {  // EOF?
            String token = nextToken();
            
            if (token != null) {
                System.out.print("=====> \"" + token + "\" ");
                String tokenType =   
                      (state ==  -2) ? "IDENTIFIER"
                    : (state ==  -5) ? "INTEGER"
                    : (state ==  -8) ? "REAL (fraction only)" 
                    : (state == -12) ? "REAL"
                    :                  "*** ERROR ***";
                System.out.println(tokenType);
            }
        }
    }
    
    int typeOf(char ch)
    {
        return   (ch == 'E')            ? E
               : Character.isLetter(ch) ? LETTER
               : Character.isDigit(ch)  ? DIGIT
               : (ch == '+')            ? PLUS
               : (ch == '-')            ? MINUS
               : (ch == '.')            ? DOT
               :                          OTHER;        
    }

    private BufferedReader reader;
    private String line = null;
    private int lineNumber = 0;
    private int linePos = -1;
    
    void nextChar()
        throws IOException
    {
        if ((line == null) || (++linePos >= line.length())) {
            line = reader.readLine();
            
            if (line != null) {
                System.out.println("[" + ++lineNumber + "] " + line);
                line += " ";
                linePos = 0;
                ch = line.charAt(0);
            }
            else ch = 0;
        }
        else {
            ch = line.charAt(linePos);
        }
    }
    
    public Scanner(String sourcePath)
    {
        try {
            reader = new BufferedReader(new FileReader(sourcePath));
        }
        catch(IOException ex) {
            ex.printStackTrace();
            System.exit(-1);
        }
    }

    public static void main(String[] args)
        throws Exception
    {
        Scanner scanner = new Scanner(args[0]);
        scanner.scan();
    }
}
