void test(int n)
{
a[1]=0;a[2]=0,a[3]=0;
int flag,i,j;
for(i=4;i<20;i++)
{
flag=0;
for(j=1;j<=(i/3);j++)
if(a[i-j]==0)
{
flag=1;
break;
}
a[i]=flag;
}
for(i=1;i<n;i++)cout<<i%10<<" ";
cout<<endl;
for(i=1;i<n;i++)
cout<<a[i]<<" ";
cout<<endl;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define G 9.81
int main()
{
double k,l,h,w;
double v;
while(~scanf("%lf%lf%lf%lf",&k,&l,&h,&w))
{
if(k==0&&l==0&&h==0&&w==0)
break;
double e=w*G*h;//重力势能
if(h>l)e-=k*(h-l)*(h-l)/2;//弹性势能
if(e<0)//绳子太短,停在空中
{
printf("Stuck in the air.\n");
}
else
{
v=sqrt(2*e/w);
if(v>10.0)
printf("Killed by the impact.\n");
else
printf("James Bond survives.\n");
}
}
return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define M 1000002
char str[M];
int next[M];
void show(int n)
{
for(int i=0;i<n;i++)
cout<<next[i]<<" ";
cout<<endl;
}
int getnext(int n)
{
int i=0,k=-1;
int ans=1;
memset(next,0,sizeof(next));
next[0]=-1;
while(i<n)
{
if(k==-1||str[i]==str[k])
{
i++;k++;
if( str[i]!=str[k])
next[i]=k;
else
next[i]=next[k];
}
else
{
k=next[k];
}
}
i=n-k;
if(n%i==0)
return n/i;
else
return 1;
}
int main()
{
while(~scanf("%s",str))
{
if(str[0]=='.')
break;
int len=strlen(str);
cout<<getnext(len)<<endl;
}
return 0;
}