#include #include #include #include #include using namespace std; const int mn=100100,M=379177,base=213; int n,m; #define hf(a) ((a)&0x7fffffff)%M struct node { node *nxt; int k,len; } *ha[M],pool[M]; int pp; node* find(int k1,int len) { for(node *p=ha[hf(k1)];p;p=p->nxt) if(k1==p->k && len==p->len)return p; return 0; } void insert(int k,int len) { int h=hf(k); pool[pp].k=k; pool[pp].len=len; pool[pp].nxt = ha[h]; ha[h]=&pool[pp++]; } char ts[mn]; string a,b; vector a1,b1,a2,b2; int pw[mn]; void getbit(string &str1,string &str2,vector &bit) { int len1,len2; len1=str1.size(); len2=str2.size(); bit.clear(); int key=0; memset(ha,0,sizeof(ha)); pp=0; for(int i=0;i &a,vector &b) { int i,j,c=0,tmp; i=a.size()-1; j=b.size()-1; while(1) { if(i<0 && j<0)break; if(i>=0)c+=a[i]; if(j>=0)c-=b[j]; if(c<0) { a[i]=2+c; c=-1; } else { a[i]=c; c=0; } i-=1; j-=1; } } int main() { pw[0]=1; for(int i=1;ia1.size()-al)printf("Hamlet\n"); else printf("Laertes\n"); } else { bool f=1; while(1) { if(bl>=b1.size())break; if(b1[bl]!=a1[al]) { if(b1[bl]>a1[al])printf("Hamlet\n"); else printf("Laertes\n"); f=0; break; } bl++; al++; } if(f)printf("Equal\n"); } } return 0; }