#include <iostream>                                                                       
#include <string>                                                                         
                                                                                          
using namespace std;                                                                      
int main()                                                                                
{                                                                                         
  string a, b;                                                                            
  cin >> a >> b;                                                                          
                                                                                          
  if (a == b) {                                                                           
    cout << "EQUAL" << endl;                                                              
    return 0;                                                                             
  }                                                                                       
  if ( a.length() == b.length() ){                                                        
    for (auto ait = begin(a), bit = begin(b);                                             
         ait != end(a); ++ait, ++bit) {                                                   
                                                                                          
      if ( *ait == *bit ) continue;                                                       
                                                                                          
      if ( *ait > *bit ) {                                                                
        cout << "GREATER" << endl;                                                        
        return 0;                                                                         
      }                                                                                   
      else {                                                                              
        cout << "LESS" << endl;                                                           
        return 0;                                                                         
      }                                                                                   
    }                                                                                     
  }                                                                                       
  else if(a.length() < b.length()) {                                                      
    cout << "LESS" << endl;                                                               
  }                                                                                       
  else {                                                                                  
    cout << "GREATER" << endl;                                                            
  }                                                                                       
}                                                                                         
                                                                                          
                                       

Measured memory_bytes: 256