semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char str[81];
	int n,N,i,k=1,l=1,len;
	scanf("%d",&N);
	getchar();
	for(n=0;n<N;n++)
	{
	
	    gets(str);
	  len=strlen(str);
	   if(len==1)
	   {
	   {
		   if(str[0]>='a'&&str[0]<='z'||str[0]>='A'&&str[0]<='Z'||str[0]=='_')
			   printf("1\n");
		   else printf("0\n");
	   }
	   }
	   else{
		if(str[0]>='a'&&str[0]<='z'||str[0]>='A'&&str[0]<='Z'||str[0]=='_')
		{
			k=1;
		}
		else k=0;

		if(k==1){
			for(i=1;(str[i]!='\0');i++){
				if((str[i]<'a'||str[i]>'z')&&(str[i]<'A'||str[i]>'Z')&&(str[i]<'0'||str[i]>'9')&&(str[i]!='_'))
				{
					l=0;
					break;
				}
				else l=1;
			}
		}
		if(k==1&&l==1)printf("1\n");
		if(k==0||l==0)printf("0\n");
		printf("\n");
	}
	}	
}
//**********************************************************
//*   ?  ?   ?: ?????C???????? .cpp        *
//*   ?       ?: ? ?                                   *
//*   ? ? ? ?: 2010?10?20?                          *
//**********************************************************
int main ()
{
	int n=0,i=0,j=0,p=0,h=0;                         //???????n???????h??????
	char a[81]=" ";                                  //??????
	cin>>n;
	cin.get( );
	for(i=0;i<n;i++)
	{
		p=0;                                         //??p??
		cin.getline(a,81,'\n');                      //?????
		for(j=0;j<81;j++)
		{
			if(a[j]=='\0')
			{
				h=j;
				break;                               //???????
			}
		}
		for(j=0;j<h;j++)
		{
			if((a[0]=='_')||((a[0]>='A')&&(a[0]<='Z'))||((a[0]<='z')&&(a[0]>='a')))//?????????????????
			{
				if(((a[j]>='A')&&(a[j]<='Z'))||((a[j]<='z')&&(a[j]>='a'))||((a[j]>='0')&&(a[j]<='9'))||a[j]=='_')
					p=1;                                                           //????????????????????
				else 
				{
					p=0;
					break;                                     //????????????????????
				}
			}
		}
		if(p==1)                                               //????
			cout<<1<<endl;
		if(p==0)                                               //?????
			cout<<0<<endl;
	}
	return 0;
}
int main()
{
 int judge(char x[]);
/* int n;
 n=cin.get() - 48;
 char a[80]={'\0'};
 for( int i = 0; i < n ; i++ )
 {
      cin.getline( a ,80 );
      cout<<judge(a)<<endl<<endl;
 }*/
/* char a[90]={'\0'};
 cin.getline( a ,90 );
 cout<<judge(a)<<endl<<endl;*/
 int n;
 cin>>n;cin.get();
 for( int i = 0; i < n ; i++ )
   {
                    char a[90]={'\0'};
                    cin.getline( a ,90 );
                    cout<<judge(a)<<endl<<endl;
   }
 cin.get();cin.get();
 return 0;  
}
int judge(char x[])//????????????????? 
{
 int rejudge(char x[]);
 if(x[0] == '_' || ( x[0]>=65 && x[0]<=90 )||( x[0]>=97 && x[0]<=122 ))
   if(rejudge(x))return 1;
 return 0;
}
int rejudge(char x[])
{
 for(int i = 0 ; i < 90 ; i++)
   if( x[i]>0&& x[i]<48|| x[i]>57&& x[i]<65|| x[i]>90&& x[i]<95|| x[i]>95&& x[i]<97|| x[i]>122/* x[i] == ' '||x[i] == ','||x[i] == '.'||x[i] == '+'||x[i] == '-'||x[i]<65||x[i]>122*/)return 0;
 return 1;
}
void main()
{
	int n,i,len,t=0;
	char a;
	char str[90];
	char *p;
	scanf("%d",&n);
	a=getchar();
	for(i=0;i<n;i++)
	{
		a=getchar();
		if((a>='a' && a<='z')||(a>='A' && a<='Z')||a=='_')
		{
			gets(str);
			len=strlen(str);
			for(p=str;p<str+len;p++)
			{
				if((*p>='a' && *p<='z')||(*p>='A' && *p<='Z')||(*p>='0' && *p<='9')||(*p=='_'))
					t++;
				else
				{
					printf("0\n");break;
				}
			}
			if(t==len)
				printf("1\n");
		}
		else
		{
			gets(str);
			printf("0\n");
		}
		t=0;
		for(p=str;p<str+90;p++)
			*p='\0';
	}
}
int main()
{
	int n,i,j,ans;
	char s[100];
	scanf("%d\n",&n);
	for (i=0;i<n;i++)
	{
		gets(s);
		ans=1;
		if ((s[0]=='_')||((s[0]>='a' && s[0]<='z')||(s[0]>='A' && s[0]<='Z')))
			for (j=1;j<strlen(s);j++)
				if ((s[j]!='_')&&(s[j]<'a' || s[j]>'z')&&(s[j]<'A' || s[j]>'Z')&&(s[j]<'0' || s[j]>'9'))
					ans=0;
				else continue;
		else 
			ans=0;
		printf("%d\n",ans);
	}
	return 0;
}
void main()
{
    char a[100];
	char *p;
	int n,i,flag;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{gets(a);
	flag=0;
	p=a;
	if(*p=='_'||(*p>='a'&&*p<='z')||*p>='A'&&*p<='Z')
	{for(p=a+1;*p!='\0';p++)
	{ 
     if(*p=='_'||(*p>='a'&&*p<='z')||*p>='A'&&*p<='Z'||*p>='0'&&*p<='9');
	 else flag=1;
	}
	 if(flag==1) printf("0\n");
	 else printf("1\n");
	}
	else printf("0\n");
	
	}
}
/*???*/
int main ()
{
	char str[100];
	int n,flag,i,j,len;
	cin >> n ;
	cin.get();
	for (i=0;i<n;i++)
	{
		flag=0;
		cin.getline(str,100);
		len=strlen(str);
		if (str[0]=='_')
		{
			flag=1;
		}
		else 
		{
			if (str[0]<='Z'&&str[0]>='A')
			{
				flag=1;
			}
			else
			{
				if (str[0]<='z'&&str[0]>='a')
				{
		    		flag=1;
				}
			}
		}
		if (flag==0)
		{
			cout << flag << endl;
			continue;
		}
		for (j=1;j<len;j++)
		{
			flag=0;
			if (str[j]<='Z'&&str[j]>='A'||str[j]<='z'&&str[j]>='a'||str[j]<='9'&&str[j]>='0'||str[j]=='_')
			{
				flag=1;
			}
			if (flag==0)
			{
				break;
			}
		}
		cout << flag << endl;
	}
	return 0;
}
int start(char a);
int sym(char b);
int main()
{
	int n,i,j,result,len;
	char c[100][81],a[100];
	gets(a);
	n=atoi(a);
	for(i=0;i<n;i++){
	gets(*(c+i));
	}
	for(i=0;i<n;i++){
	len=strlen(*(c+i));
	result=1;
	if(start(*(c[i]+0))==0)
		printf("0\n");
	if(start(*(c[i]+0))==1){
		for(j=0;j<len;j++){
		result*=sym(*(c[i]+j));
		}
		if(result==1){
		printf("1\n");
		}else{
		printf("0\n");
		}
	}
	}
	return 0;
}
int start(char a){
	int m;
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||a=='_'){
	m=1;
	}else{
	m=0;
	}
	return m;
}
int sym(char b){
	int n;
	if((b>='a'&&b<='z')||(b>='A'&&b<='Z')||(b>='0'&&b<='9')||b=='_'){
	n=1;
	}else{
	n=0;
	}
	return n;
}
int main()
{
    int i;
    int judge(char a[]); //???????????????
    int n;
    int b[100];
    cin>>n;
    cin.get(); //???????
    for(int j=1;j<=n;j++) //??n????
    {
       char a[85];
       for(i=0;i<85;i++) a[i]=0;

       cin.getline(a,85);
       b[j]=judge(a); //??????????????b

       for(i=0;i<85;i++) a[i]=0; //???????

    }
    for(i=1;i<=n;i++) cout<<b[i]<<endl; //???????

    return 0;

}
int judge(char a[]) //???????????????
{
    int i;
    for(i=0;i<85;i++) //??????????
    {
        if(a[i]==' ')
        {
            return 0;
            break;
        }
    }
    if(((int)a[0]>=97&&(int)a[0]<=122)||((int)a[0]>=65&&(int)a[0]<=90)||(int)a[0]==95)
    {
        for(i=1;i<85;i++)
        {
            if(((int)a[i]>=1&&(int)a[i]<=47)||((int)a[i]>=58&&(int)a[i]<=64)||((int)a[i]>=91&&(int)a[i]<=94)||(int)a[i]==96||(int)a[i]>=123)
            {
                return 0;
                break;
            }

        }
        if(i==85) return 1;
    }
    else return 0;
}
char s[100] = {0};

int main ( )
{
	int n;
	cin >> n;
	cin.getline ( s, 100 );
	for ( int i = 0; i < n; i ++ )
	{
		cin.getline ( s, 100 );
		int len = strlen ( s ), j = 1;
		if ( ! ( s[0] == '_' || ( s[0] >= 'A' && s[0] <= 'Z' ) || ( s[0] >= 'a' && s[0] <= 'z' ) ) )
		{
			cout << 0 << endl;
			continue;
		}
		for ( j = 1; j < len; j ++ )
		{
			if ( ! ( s[j] == '_' || ( s[j] >= 'A' && s[j] <= 'Z' ) || ( s[j] >= 'a' && s[j] <= 'z' ) || ( s[j] >= '0' && s[j] <= '9' ) ) )
			{
				cout << 0 << endl;
				break;
			}
		}
		if ( j == len )
			cout << 1 << endl;
	}
	return 0;
}
int main(){
	int *t,i,j,n,is[10000];
	char a[81];
	char *p;
	t=is;
	for (i=1;i<=100;i++) *(t+i)=1;
	scanf("%d\n",&n);
	for (i=1;i<=n;i++){
		gets(a);
		p=a;
		if (*p<65 || *p>90 && *p<97 && *p!=95 || *p>122) *(t+i)=0;
		for (j=1;j<strlen(a);j++)
			if (*(p+j)<48 || *(p+j)>57 && *(p+j)<65 || *(p+j)>90 && *(p+j)<97 && *(p+j)!=95 || *(p+j)>122) *(t+i)=0;

	}
	for (i=1;i<=n;i++)
		printf("%d\n",*(t+i));
	

}
/*
 * judgement.cpp
 *
 *  Created on: 2011-12-2
 *      Author: 11095
 */

int main()
{
	int n,i;
	cin>>n;
	cin.get();
	char str[100];
	for(i=1;i<=n;i++){
		cin.getline(str,100);
		int ans=1,i=0;
		if(str[0]>='0'&&str[0]<='9')  //????
		{
			ans=0;
			cout<<ans<<endl;
			continue;
		}

		char *p=str;
		for(p=str;i<strlen(str);i++,p++){
			if(*p>='0'&&*p<='9'||*p>='a'&&*p<='z'||*p>='A'&&*p<='Z'||*p=='_')  //??????
				continue;
			else
			{
				ans=0;
				break;
			}
		}
		cout<<ans<<endl;
	}

}
int main()
{char (*p)[81];
 int n,i,j,flag;
 scanf("%d",&n);
 p=(char (*)[81])calloc(n,sizeof(char)*81);
 getchar();
 gets(*p);
 for(i=1;i<n;i++)
 gets(*(p+i));
 for(i=0;i<n;i++)
 {flag=1;
  if(*(*(p+i))!='_'&&(*(*(p+i))>'Z'||*(*(p+i))<'A')&&(*(*(p+i))>'z'||*(*(p+i))<'a'))
  flag=0;
  if(flag==1)
  {for(j=0;j<strlen(*(p+i));j++)
   if(*(*(p+i)+j)!='_'&&(*(*(p+i)+j)>'Z'||*(*(p+i)+j)<'A')&&(*(*(p+i)+j)>'z'||*(*(p+i)+j)<'a')&&(*(*(p+i)+j)>'9'||*(*(p+i)+j)<'0'))	
   {flag=0;break;}}
  printf("%d\n",flag);}
}
int main()
{
	int panduan(char *z,int len);
	int i,n,len;
	char zifu[82],*z=zifu;
	gets(zifu);
	n=atoi(zifu);
	for(i=0;i<n;i++){
		gets(zifu);
		len=strlen(zifu);
		printf("%d\n",panduan(z,len));
	}
	return 0;
}
int panduan(char *z,int len)
{
	int i;
	for(i=0;i<len;i++){
		if(i==0){
			if(*z!='_'&&(*z>'z'||*z<'a')&&(*z>'Z'||*z<'A'))
				return 0;
		}
		else{
			if(*(z+i)!='_'&&(*(z+i)>'z'||*(z+i)<'a')&&(*(z+i)>'Z'||*(z+i)<'A')&&(*(z+i)>'9'||*(z+i)<'0'))
				return 0;
		}
	}
	return 1;
}
int main()
{
 int n,l,p,m;
 char str[81];
 cin>>n;
 getchar();
 for(int j=1;j<=n;j++)
  {cin.getline(str,81);
  l=strlen(str);
  if((str[0]=='_')||(str[0]>='a'&&str[0]<='z')||(str[0]>='A'&&str[0]<='Z'))
	  m=1;
  else m=0;
  for(int i=0;i<l;i++)
   {
	  if((str[i]<='9'&&str[i]>='0')||(str[i]=='_')||(str[i]>='A'&&str[i]<='Z')||(str[i]>='a'&&str[i]<='z'))
	     p=1;
	  else {
		  p=0;
		  break;
	  }

    }
  if(m==1&&p==1)
   cout<<"1"<<endl;
  else cout<<"0"<<endl;
   }
   return 0;
  }
int qualification ( char a[90] )       //???????????????????????????
{
	int result=0,flag=0,i=0,l=0;
	if ( a[0]==95 || (a[0]>64 && a[0]<91) || (a[0]>96 && a[0]<123) )      //??????????ASCII????????????????????
		flag=0;                                          //????????????0
	else 
	{
		flag=1;                                          //?????????????1
        return 1;
	}

	l=strlen(a);
	for (i=1;i<l;i++)                      //???????????????????????????
	{
		if ( a[i] ==95 || (a[i]>64 && a[i]<91) || (a[i]>96 && a[i]<123) || (a[i]>47 && a[i]<58) )
		{
			flag=0;                         //????
			continue;
		}
		else 
		{
			flag=1;
			break;
		}
	}

	if (flag==1)                          //????
		result=1;
	else if (flag==0)
		result=2;
	return result;
}

int main()
{
	char a[90];
	int n=0,i=0;
	cin>>n;
	gets(a);
	for (i=0;i<n;i++)                      //????????
	{
		gets(a);
		cout<< qualification (a)-1 <<endl;      //????
	}
	return 0;
}
main()
{
      int n,i,j,k;
      char a[90];
      scanf("%d",&n);
      char s[2];
      gets(s);
      for(i=0;i<n;i++)
      {
                      gets(a);
                       j=strlen(a);
                       for(k=0;k<j;k++)
                       {
                                       if(k==0)
                                       {
                                              if(a[k]=='_' || (a[k]>='a'&& a[k]<='z') || (a[k]>='A' && a[k]<='Z'))
                                              continue;
                                              else 
                                              {
                                                   printf("0\n");
                                                   break;
                                              }
                                       }
                                       else{
                                            if(a[k]=='_' || (a[k]>='a'&&a[0]<='z') || (a[k]>='A' && a[k]<='Z') || (a[k]>='0'&&a[k]<='9'))
                                            continue;
                                            else
                                            {
                                                printf("0\n");
                                                break;
                                            }
                                            }
                                       
                       }
                       if(k==j)
                       printf("1\n");
      }
      getchar();
      getchar();
}
//a ???97,z:122;A65;Z90;???95;0,48;9,57

int main()
{
	int n;
	cin>>n;
	int b[100];
	int j=0;
	int k=0;
	cin.get();
	for (j=1;j<=n;j++)
	{
	

	char c;
	int i=0;
	char a[100];
	while(cin.get(c))
	{
		if (c=='\n')
			break;
		a[i]=c;
		i=i+1;

	}
	int asc;
	asc=a[0];
	if (asc==95||(asc>=97&&asc<=122)||(asc>=65&&asc<=90))
	{
		int count=0;
		for (k=1;k<=i-1;k++)
		{
			int lin;
			lin=a[k];
			if ((a[k]<48)||(a[k]>57&&a[k]<65)||(a[k]>90&&a[k]<95)||(a[k]>122)||(a[k]>95&&a[k]<97))
				count=1;
		}
		if (count==0) b[j]=1; else b[j]=0;
		
	}
	else
		b[j]=0;

	}
	for (j=1;j<=n;j++)
		cout<<b[j]<<endl;


	return 0;

}
int main()
{
	int n,judge[100],i,j,k,t,length;
	char ch[81];
	for(k=1;k<=100;k++)
		judge[k-1]=1;
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		gets(ch);
		if(ch[0]=='_'||(ch[0]>='a'&&ch[0]<='z')||(ch[0]>='A'&&ch[0]<='Z'))
		{
			length=strlen(ch)-1;
			for(j=1;j<=length;j++)
			{
				if(ch[j]=='_'||(ch[j]>='a'&&ch[j]<='z')||(ch[j]>='A'&&ch[j]<='Z')||(ch[j]>='0'&&ch[j]<='9'));
				else judge[i-1]=0;
			}
		}
		else judge[i-1]=0;
	}
	for(t=1;t<=n;t++)
		printf("%d\n",judge[t-1]);
}
main()
{
      int n;
      scanf("%d",&n);getchar();
      for(;n>0;n--)
      {
      int i=0;
         char str[88];
       for(i=0;i<88;i++)
       {
           str[i]='a';
       }  
       gets(str);
       //scanf("%s",str);
       
       for(i=0;i<strlen(str);i++)
       {
             if((!isalnum(str[i]))&&str[i]!='_')
             {
                 printf("%d\n",0);
                 goto hhh;
             }                    
       }
         //printf("%c",str[0]);
        //char a=str[0]; 
        //if((str[0]<="z"&&str[0]>="a")||(str[0]<="Z"&&str[0]>="A")||str[0]=="_")
        if(isalpha(str[0])||str[0]=='_')
            {
                printf("%d\n",1);
            }          
         else
            {
                printf("%d\n",0);
            }   hhh:;
      }/*getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      getchar();getchar();getchar();getchar();getchar();getchar();getchar(); */
}
void main()
{
	int n,i,j,k;
	char str[100],*p,c;
	p=str;
	scanf("%d",&n);
	gets(str);
	for(i=0;i<n;i++)
	{
		gets(str);
		k=1;
		for(j=0;*(p+j)!='\0';j++)
		{
			c=*(p+j);
			if(j==0)
				if((c<'a'||c>'z')&&(c<'A'||c>'Z')&&c!='_')
				{
					k=0;
					break;
				}
			if(j!=0)
				if((c<'a'||c>'z')&&(c<'A'||c>'Z')&&c!='_'&&(c<'0'||c>'9'))
				{
					k=0;
					break;
				}
		}
		printf("%d%s",k,i==n-1?"":"\n");
	}
}
int main()
{
	int n = 0;
	char a[10000][82] = {0};
	int b[10000] = {0};
	int i = 0;
	int j = 0;

	cin >> n;
	cin.get();
	for (i = 1; i <= n; i ++)
	{
		cin.getline(a[i],82);
	}

	for (i = 1; i <= n; i ++)
	{
		if ((a[i][0] == '_') || ((a[i][0] >= 'a') && (a[i][0] <= 'z'))
			|| ((a[i][0] >= 'A') && (a[i][0] <= 'Z')))
		{
			b[i] = 1;
			for (j = 1; j <= 82; j ++)
			{
				if (a[i][j] == '\0')
					break;
				if ((a[i][j] == '_') || ((a[i][j] >= 'a') && (a[i][j] <= 'z'))
				|| ((a[i][j] >= 'A') && (a[i][j] <= 'Z'))
				|| ((a[i][j] >= '0') && (a[i][j] <= '9')))
					b[i] = 1;
				else
				{
					b[i] = 0;
					break;
				}
			}
		}
		else
			b[i] = 0;
	}

	for (i = 1; i <= n; i ++)
		cout << b[i] << endl;

	return 0;
}
int main()
{
	char a[200][200];
	int i,j,n,flag;
	cin>>n;
	for(i=0;i<=n;i++)
	{
		cin.getline(a[i],200);
	}
	for(i=1;i<=n;i++)
	{
		flag=1;
		if(a[i][0]=='_'||a[i][0]<='Z'&&a[i][0]>='A'||a[i][0]<='z'&&a[i][0]>='a')
		{
			for(j=0;a[i][j]!='\0';j++)
			{
				if(a[i][j]!='_'&&(a[i][j]>'Z'||a[i][j]<'A')&&(a[i][j]>'z'||a[i][j]<'a')&&(a[i][j]>'9'||a[i][j]<'0'))
				{
					flag=0;
					break;
				}
			}
		}
		else
			flag=0;
		cout<<flag<<endl;
	}
	return 0;
}
int main()
{
    int n,i,j,jud[200] = {0};//,a[20][80]
int l[200];//????????l???????????????????????????19???????????
    char s[200][85],str[5]; 
    gets(str);
    n=atoi(str);
    for(i=0;i<n;i++)
    {
       gets(s[i]);
    }
/*
    for(i=0;i<n;i++)
    {
       l=strlen(s[i]);
       for(j=0;j<l;j++)
       a[i][j]= s[i][j];
    }
*///??????????????
    for(i=0;i<n;i++)
    {
      l[i]=strlen(s[i]);
      if(s[i][0]!='_')
      {
         if(s[i][0]<'A')
         {
         printf("0\n");
          jud[i]=1;
          continue;//??break
         }  
          if((s[i][0]<'a')&&(s[i][0]>'Z'))
         {
         printf("0\n");
          jud[i]=1;
         continue;//??break
         }         
         if(s[i][0]>'z')
         {
         printf("0\n");
          jud[i]=1;
          continue;//??break
         }
      }
      for(j=1;j<l[i];j++)
      {
        if(s[i][j]!='_')
      {
         if(s[i][j]<'0')
         {
         printf("0\n");
          jud[i]=1;
          break;
         }  
         if((s[i][j]>'9')&&(s[i][j]<'A'))
          {
         printf("0\n");
          jud[i]=1;
          break;
         }  
          if((s[i][j]<'a')&&(s[i][j]>'Z'))
         {
         printf("0\n");
          jud[i]=1;
          break;
         }         
         if(s[i][j]>'z')
         {
         printf("0\n");
          jud[i]=1;
          break;
         }
}
      if(jud[i] == 1)
      break;
      }
      if(jud[i] == 0)
      printf("1\n");
    }
return 0;
}
void main()
{
	int n;
	scanf("%d\n",&n);
	char str[100][200];
	int i;
	for (i=0;i<n;i++)
		gets(str[i]);
	for (i=0;i<n;i++)
	{
		char *p;
		int k=1;
		p=&str[i][0];
		if (('A'<=*p&&*p<='Z')||('a'<=*p&&*p<='z')||*p=='_')
		{
			for (p=p+1;*p!='\0'&&k==1;p++)
			{
				if (('A'<=*p&&*p<='Z')||('a'<=*p&&*p<='z')||*p=='_'||('0'<=*p&&*p<='9'))
					k=1;
				else k=0;
			}
		}
		else k=0;
		printf("%d\n",k);
	}
}
int main()
{
	int i,l,j,n;
	char a[81];
	scanf("%d\n",&n);
	for(j=1;j<=n;j++)
	{
		gets(a);
        l=strlen(a);
		i=0;
		if(('A'<=a[0]&&a[0]<='Z')||('a'<=a[0]&&a[0]<='z')||(a[0]=='_'))
		{
			for(i=1;i<l;i++)
			{
				if(!(('A'<=a[i]&&a[i]<='Z')||('a'<=a[i]&&a[i]<='z')||('0'<=a[i]&&a[i]<='9')||a[i]=='_'))
					break;
			}
		}
		if(i>=l)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int main()
{
	int n;
	cin >> n;
	cin.get();
	char word[81];
	int j, i;
	for (i = 1;i <= n; i++)
	{
		cin.getline(word, 81);
		int flag = 0;
		if (word[0] != '_' && (word[0] < 'a' || word[0] > 'z') && (word[0] < 'A' || word[0] > 'Z'))
		{
			cout << flag << endl;
		}
		else
		{
			for (j = 0; word[j] != '\0'; j++)
			{
				if (word[j] == '_' || (word[j] >= 'a' && word[j] <= 'z') || (word[j] >= 'A' && word[j] <= 'Z') || (word[j] >= '0' && word[j] <= '9'))
					continue;
				else 
				{

					break;
				}
			}
			if (word[j] == '\0')
				flag = 1;
			cout << flag << endl;
		}
		cin.clear();
	}
	return 0;
}
/*
 * 5.cpp
 *
 *  Created on: 2010-11-24
 *      Author: hanzhe
 */


int main(){//????
	int n;
	char a[81];
	cin>>n;         //????
	cin.getline(a,81);//?????
	while(n>0){        //???
		int g=0,i,na;  //g=1????
		cin.getline(a,81);//??
		na=strlen(a);     //??
		if((a[0]=='_')+((a[0]-'a'>=0)&&(a[0]-'z'<=0))+//???????_,a~z,A~Z?
				((a[0]-'A'>=0)&&(a[0]-'Z'<=0))==1)
			g=1;
		for(i=1;i<na;i++){          //??????????(?_,a~z,
			if((a[i]=='_')+((a[i]-'a'>=0)&&(a[i]-'z'<=0))+((a[i]-'A'>=0)&&(a[i]-'Z'<=0))+
					((a[i]-'0'>=0)&&(a[i]-'9'<=0))==1)
				g=g*1;
			else g=0;
		}
		if(g==1)cout<<"1"<<endl;
		else cout<<"0"<<endl;
		n--;
	}
	return 0;
}//????
int main()
{
	char a[1000];
	int flag1,flag2,i,j,n,lena;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		flag1=0;
		flag2=1;
		cin.getline(a,1000);
		lena=strlen(a);
		if(lena==1)
		{
			if(a[0]<=57&&a[0]>=48||a[0]<=90&&a[0]>=65||a[0]>=97&&a[0]<=122||a[0]=='_')
				cout<<"1"<<endl;
			else cout<<"0"<<endl;

		}
		if(lena>1)
		{
			if(a[0]<=90&&a[0]>=65||a[0]>=97&&a[0]<=122||a[0]=='_')
			{
				flag1=1;
			}
			for(j=1;j<lena;j++)
			{
				if((a[j]>=97&&a[j]<=122)+(a[j]<=90&&a[j]>=65)+(a[j]=='_')+(a[j]>=48&&a[j]<=57)==0)
				{
					flag2=0;
					break;
				}
			}
		
			if(flag1+flag2>=2)
				cout<<"1"<<endl;
			if(flag1+flag2<2)
				cout<<"0"<<endl;
		}
		
	}
	return 0;
}
int main()
{
    int n,i,j,l[200],jud=0;
    char s[200][85],str[5]; 
    gets(str);
    n=atoi(str);
    for(i=0;i<n;i++)
    {
       gets(s[i]);
    }
    for(i=0;i<n;i++)
    {
       jud=0;
      l[i]=strlen(s[i]);
      if(s[i][0]!='_')
      {
         if(s[i][0]<'A')
         {
         printf("0\n");
          jud=1;
         continue;
         }  
          if((s[i][0]<'a')&&(s[i][0]>'Z'))
         {
         printf("0\n");
          jud=1;
         continue;
         }         
         if(s[i][0]>'z')
         {
         printf("0\n");
          jud=1;
         continue;
         }
      }
      for(j=1;j<l[i];j++)
      {
        if(s[i][j]!='_')
      {
         if(s[i][j]<'0')
         {
         printf("0\n");
          jud=1;
          break;
         }  
         if((s[i][j]>'9')&&(s[i][j]<'A'))
          {
         printf("0\n");
          jud=1;
          break;
         }  
          if((s[i][j]<'a')&&(s[i][j]>'Z'))
         {
         printf("0\n");
          jud=1;
          break;
         }         
         if(s[i][j]>'z')
         {
         printf("0\n");
          jud=1;
          break;
         }
      }
      }
      if(jud == 0)
      printf("1\n");
    }
    getchar();
    getchar();
}
int main()
{
  int n,i,j,p[100]={0};                      //????n,????i,j,??p[100]
  char a[100][81];                            //??????a[100][80]
  cin>>n;                                    //??n???
  cin.get(); 
  for(i=0;i<n;i++)
	  cin.getline(a[i],81);
  for(i=0;i<n;i++)                       //?????p[i]=1,??p[i]=0
  {   
	 if((a[i][0]>='a'&&a[i][0]<='z')||(a[i][0]>='A'&&a[i][0]<='Z')||(a[i][0]=='_'))
	 {	 p[i]=1;
		 for(j=0;a[i][j]!='\0';j++)
		 { if((a[i][j]>='a'&&a[i][j]<='z')||(a[i][j]>='A'&&a[i][j]<='Z')||(a[i][j]=='_')||(a[i][j]>='0'&&a[i][j]<='9'))
				p[i]=1;
			else {p[i]=0;break;}
		 }
	 }
	 else p[i]=0;
  }
  for(i=0;i<n;i++)                //??p[i]
	  cout<<p[i]<<endl;
  return 0;                  //?????
}
void main()
{
    char origin_string[81];
    int n,i,j,length;
    int check=0;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        gets(origin_string);
        length=strlen(origin_string);
        if(origin_string[0]=='_'||(origin_string[0]>='A'&&origin_string[0]<='Z')||(origin_string[0]>='a'&&origin_string[0]<='z'))
		{
			check=1;
		}
        else  
		{
			check=0;
		}
        for(j=1;j<length;j++)
        {
            if(check==1)
            {
				if(origin_string[j]==' ')
				{
				      check=0;
					  break;
				}

	            if(origin_string[j]=='_'||(origin_string[j]>='A'&&origin_string[j]<='Z')||(origin_string[j]>='a'&&origin_string[j]<='z')||(origin_string[j]>='0'&&origin_string[j]<='9'))
				{
					check=1;
				}
				else
				{
				    check=0;
					break;
				}
			}
        }
        printf("%d\n",check);
    }
}
//???? 
int main()
{
    int n=0;   //??????
    int i=0;  //???? 
    int j=0;
    int pan=0;  //???????? 
    char str[90];  //????? 
    for(i=0;i<90;i++)
    {
        str[i]=0;
    }
    
    cin>>n;
    cin.get();
    for(i=0;i<n;i++)
    {
        cin.getline(str,90);
        
            if(str[0]=='_'||(str[0]>='a'&&str[0]<='z')||(str[0]>='A'&&str[0]<='Z'))
            {
                for(j=0;str[j]!=0;j++)
                {
                    if((str[j]=='_'||(str[j]>='a'&&str[j]<='z')||(str[j]>='A'&&str[j]<='Z')||(str[j]>='0'&&str[j]<='9')))
                    {
                        pan=0;
                    }
                    else
                    {
                        pan=1;
                        break;
                    }
                }
                if(pan==1)
                {
                    cout<<0<<endl;
                }
                else
                {
                    cout<<1<<endl;
                }
            }
            else
            {
                cout<<0<<endl;
            }
    } 
    return 0;
}