semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
char na[100];

int main ( )
{
	int num;
	cin >> num;
	cin.getline ( na, 100 );
	while ( num -- )
	{
		memset ( na, ' ', sizeof ( na ) );
		cin.getline ( na, 100 );
		int index = 0, len = 0;
		len = strlen ( na );
		if ( !( na[index] == '_' || ( na[index] <= 'z' && na[index] >= 'a' ) || ( na[index] <= 'Z' && na[index] >= 'A' ) ) )
		{
			cout << 0 << endl;
			continue;
		}
		index ++;
		for (  ; index < len; index ++ )
		{
			if ( na[index] == '_' || (na[index] >= '0' && na[index] <= '9' ) || ( na[index] <= 'z' && na[index] >= 'a' ) || ( na[index] <= 'Z' && na[index] >= 'A' ) )
				continue;
			else
			{
				cout << 0 << endl;
				break;
			}
		}
		if ( index == len )
			cout << 1 << endl;
	}
	return 0;
}
int main()
{
	int i=0,n=0,j=0,b=0;
	char test[81];
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		b=1;
		gets(test);
		if(!(test[0]=='_'||(test[0]>='A'&&test[0]<='Z')||(test[0]<='z'&&test[0]>='a')))
			b=0;
		for(j=1;j<strlen(test);j++)
		{
			if(!(test[j]=='_'||(test[j]>='A'&&test[j]<='Z')||(test[j]<='z'&&test[j]>='a')||(test[j]>='0'&&test[j]<='9')))
			{
				b=0;
			}
		}
		if(b==1)
			cout<<1<<endl;
		else
			cout<<0<<endl;
	}
	return 0;
}
int main()
{
	int n,i,j,k[200];																			//??????????????
	char str[200][81];																			//??????
	cin>>n;
	for(i=0;i<=n;i++)
		cin.getline(str[i],81,'\n');
	for(i=1;i<=n;i++)
	{
		k[i]=0;																					//????????0
		if(str[i][0]!=95&&(str[i][0]<65||str[i][0]>122||(str[i][0]>90&&str[i][0]<97)))
			continue;																			//?????????????
		else
			k[i]=1;																				//???????1
		for(j=1;j<=81;j++)
		{
			if(str[i][j]=='\0')
				break;																			//???????
			else if(str[i][j]!=95&&(str[i][j]<48||str[i][j]>122||(str[i][j]>57&&str[i][j]<65)||(str[i][j]>90&&str[i][j]<97)))
			{
				k[i]=0;																			//????????????0
				break;																			//????
			}
			else
				k[i]=1;																			//???????????1
		}
	}
	for(i=1;i<=n;i++)
		cout<<k[i]<<endl;
	return 0;
}
void main()
{
	char a[85];
	int i,j,k,m;
	scanf("%d\n",&k);
	for(i=0;i<k;i++)
	{
		m=1;
		gets(a);
		if((a[0]>='a' && a[0]<='z') || (a[0]<='Z' && a[0]>='A') || a[0]=='_')
		{
			for(j=1;a[j]!='\0';j++)
			{
				if((a[j]>='a' && a[j]<='z') || (a[j]<='Z' && a[j]>='A') || a[j]=='_' || (a[j]>='0' && a[j]<='9'))
					continue;
				else
				{
					m=0;
					break;
				}
			}
		}
		else
			m=0;
		printf("%d\n",m);
	}
}
int main()
{
	int n;
	int i,j,k,counta=0,countc=0;
	scanf("%d",&n);
	char legal[81];
	getchar();

	for(i=0;i<n;i++)
	{
		gets(legal);
		k=strlen(legal);

		if(k==1)
		{
            countc=0;
			if((*(legal)>='A'&&*(legal)<='Z')||(*(legal)>='a'&&*(legal)<='z')||(*(legal)=='_'))
			{
				countc++;
			}
			if(countc==1)
			{
				printf("1\n");
			}
			else
			{
				printf("0\n");
			}
		}

		else
		{
			if((*(legal)>='A'&&*(legal)<='Z')||(*(legal)>='a'&&*(legal)<='z')||(*(legal)=='_'))
			{
                counta=0;
				for(j=1;j<k;j++)
				{
					if((*(legal+j)>='A'&&*(legal+j)<='Z')||(*(legal+j)>='a'&&*(legal+j)<='z')||
                    (*(legal+j)=='_')||(*(legal+j)>='0'&&*(legal+j)<='9'))
						counta++;
				}
				if (counta==k-1)
				{
					printf("1");
					printf("\n");
				}
				else
				{
					printf("0");
					printf("\n");
				}
			}
			else
			{
				printf("0");
				printf("\n");
			}
		}
	}
	return 0;
}
int main()
{
    int n,i,l;
    scanf("%d\n",&n);
    char a[100];
    for(i=0;i<n;i++)
    {
        gets(a);
        int j;
        l=strlen(a);
        if (a[0]=='_')
        {
            for(j=1;j<l;j++)
            {
                if (a[j]>='A'&&a[j]<='Z')
                 ;
                 else if (a[j]=='_')
                 ;
                 else if (a[j]>='a'&&a[j]<='z')
                 ;
                 else if (a[j]>='0'&&a[j]<='9')
                  ;
                  else 
                  {printf("0\n");
                  break;}
                     
            }
            if (j==l)
            printf("1\n");
        }
        else if (a[0]>='a'&&a[0]<='z')
        {
             for(j=1;j<l;j++)
            {
                if (a[j]>='A'&&a[j]<='Z')
                 ;
                 else if (a[j]=='_')
                 ;
                 else if (a[j]>='a'&&a[j]<='z')
                 ;
                 else if (a[j]>='0'&&a[j]<='9')
                  ;
                  else 
                  {printf("0\n");
                  break;}
                     
            }
            if (j==l)
            printf("1\n");
        }
        else if (a[0]>='A'&&a[0]<='Z')
        {
             
             for(j=1;j<l;j++)
            {
                if (a[j]>='A'&&a[j]<='Z')
                 ;
                 else if (a[j]=='_')
                 ;
                 else if (a[j]>='a'&&a[j]<='z')
                 ;
                 else if (a[j]>='0'&&a[j]<='9')
                  ;
                  else 
                  {printf("0\n");
                  break;}
                     
            }
            if (j==l)
            printf("1\n");
        }
        else printf("0\n");
    }
    getchar();
    getchar();
    getchar();
}
int main()
{
  char num[10];
  char s[1000][80];
  int n,i,j,l,m=0;
  gets(num);
  n=atoi(num);
  for(i=0;i<n;i++)
  {
       gets(s[i]);
       l=strlen(s[i]);
       
       if((s[i][0]<='z'&&s[i][0]>='a')||(s[i][0]<='Z'&&s[i][0]>='A')||(s[i][0]=='_'))
       {m=1;
       
       for (j=0;j<l;j++)
          {
           if((s[i][j]<='z'&&s[i][j]>='a')||(s[i][j]<='Z'&&s[i][j]>='A')||(s[i][j]>='0'&&s[i][j]<='9')||(s[i][j]=='_')) 
           {m=1;}
           else
           {m=0;}
           if(m==0)
           break;
           } 
       
       }
       else
       {m=0;}
      
        
           
         printf("%d\n",m);  
                                  
  }    
  getchar();
  getchar();
  return 0;      
}
int main()
{
	int n,i,j,len,o[1000],*po;
	char m[1000][81],*pm[1000];
	scanf("%d",&n);
	po=o;
	for(i=0;i<n+1;i++){
		pm[i]=m[i];
		gets(pm[i]);
	}
	for(i=1;i<n+1;i++){
		len=strlen(pm[i]);
		if(*pm[i]>='0'&&*pm[i]<='9'){
			*(po+i)=0;
		}
		else{
			for(j=0;j<len;j++){
				if(*(pm[i]+j)==' '||*(pm[i]+j)=='.'||*(pm[i]+j)=='+'||*(pm[i]+j)=='-'||*(pm[i]+j)=='@'||*(pm[i]+j)=='='){
					o[i]=0;
					break;
				}
				else{
					*(po+i)=1;
				}
			}
		}
	}
	for(i=1;i<n+1;i++){
		printf("%d\n",*(po+i));
	}
	return 0;
}
int main()
{
    int n,j;    
    int i=1;
    scanf("%d",&n);
     
     int k;
    while (i<=n+1)
    { 
       
          char a[1000];
          gets(a);
          int l;
          l=strlen(a);
          if (l>1)
          {
                         if (a[0]<='z'&&a[0]>='A')
                             {
                                           k=l-1;       j=1;
                               while (j<l)
                               {
                                  if (a[j]>='A'&&a[j]<='z')
                                       
                                             k--;
                                       
                                   else if (a[j]>='0'&&a[j]<='9')
                                      
                                              k--;
                                       
                                   else if (a[j]=='_')
                                               k--;
                                  
                                   j++;
                                }
                               if (k==0)
                                          printf("1\n");
                               else
                                         printf("0\n");
                        }
                        else if (a[0]=='_')
                            { 
                                j=1;k=l-1;
                                   while (j<l)
                                     {
                                        if (a[j]>='A'&&a[j]<='z')
                                   
                                                  k--;
                                              
                                        else if (a[j]>=('0')&&a[j]<=('9'))
                                             
                                                 k--;
                                              
                                         else if (a[j]=='_')
                                                 k--;
                                          
                                           j++;
                                       }
                                     if (k==0)
                                          printf("1\n");
                                     else
                                          printf("0\n");
                              }
                         else 
                         printf("0\n");
          }
          else if (l==1)
          {
                  if (a[0]>='A'&&a[0]<='z')
                  printf("1\n");
                  else if (a[0]=='_')
                  printf("1\n");
                  else printf("0\n");

          }
          i++;
    }
    getchar();getchar();getchar();getchar();getchar();getchar();getchar();
    getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
void main()
{
    int n,k;
    char a[100][100];
    char (*p)[100];
    char *q;
    scanf("%d\n",&n);
    for(p=a;p<a+n;p++)
    {
    	gets(*p);
    }
    for(p=a;p<a+n;p++)
    {
    	if(**p=='_'||((**p>='a')&&(**p<='z'))||((**p>='A')&&(**p<='Z')))
    	{
    		for(q=*p;*q!=0;q++)
    		{
    			if(*q=='_'||((*q>='a')&&(*q<='z'))||((*q>='A')&&(*q<='Z'))||((*q>='0')&&(*q<='9')))
    			k=1;
    			else
    			{
    				k=0;break;
    			}
    		}
    	}
    	else
    	k=0;
    	printf("%d\n",k);
    }
}
main ()
{
int a,i,j,x,y=0,z;
char s[81];
char c;
scanf("%d",&a);
getchar();
for (i=1;i<=a;i++)
{

    gets(s);
    x=1;
    for (j=0;s[j]!='\0';j++)
    {
        if(j==0 && !(s[j]>='A'&&s[j]<='Z') && !(s[j]>='a'&&s[j]<='z') && s[j]!='_')
         {
             x = 0;
             break;
         }
        else if(j>0 && !(s[j]>='A'&&s[j]<='Z') && !(s[j]>='a' && s[j]<='z') && s[j]!='_' && !(s[j]>='0' && s[j]<='9'))
        {
           x = 0;
           break;
       }
      
    }
printf("%d\n",x);
 }
}
void main()
{
	int n,i,j,s;
	scanf("%d",&n);
	int *q;
	q=(int *)malloc(n*sizeof(int));
	char *str;
	str=(char*)malloc(80*sizeof(char));
	gets(str);
	char **p;
	p=(char**)malloc(n*sizeof(char*));
	for(i=0;i<n;i++)
	{
      *(p+i)=(char*)malloc(80*sizeof(char));
	   gets(*(p+i));
	   if((**(p+i))<'A'||((**(p+i))>'Z'&&(**(p+i))<'a'&&(**(p+i))!='_')||(**(p+i))>'z')
		   *(q+i)=0;
	   else 
	   {
		   if(*(*(p+i)+1)=='\0')
			   *(q+i)=1;
		   for(j=1;j<81,*(*(p+i)+j)!='\0';j++)
		   {
			   s=0;
			   if(*(*(p+i)+j)<'0'||(*(*(p+i)+j)>'9'&&*(*(p+i)+j)<'A')||(*(*(p+i)+j)>'Z'&&*(*(p+i)+j)<'a'&&*(*(p+i)+j)!='_')||*(*(p+i)+j)>'z')
               {
	              *(q+i)=0;
                   break;
			   }
			   else s++;
		   if(s>0)
			   *(q+i)=1;
		   else *(q+i)=0;
		   }
	   }
	  }
	for(i=0;i<(n-1);i++)
		printf("%d\n",*(q+i));
	printf("%d",*(q+i));
}
int main()
{
	int n,i,j,y,l;
	char x[100];
	y=1;
	cin>>n;
	cin.get();
	
	for(i=0;i<n;i++)
	{
		cin.getline(x,81,'\n');
		
		y=1;
		l=strlen(x);
		if(x[0]=='_'||(x[0]>='A'&&x[0]<='Z')||(x[0]>='a'&&x[0]<='z'))
		{


			for(j=0;j<l;j++)
			{
				if(((x[j]>='A'&&x[j]<='Z')||(x[j]>='a'&&x[j]<='z')||(x[j]>='0'&&x[j]<='9')||(x[j]=='_'))==0)
				{
					y=0;

				}
			}
			

			if(y==0)
			{
				cout<<"0"<<endl;
			}
			if(y==1)
			{
				cout<<"1"<<endl;
			}


				

		}
		else
		{
			cout<<"0"<<endl;
		}


	}
	



	return 0;
}
int main()
{
	int num,i,j,k,flag;
	char a[81];
	scanf("%d",&num);
	getchar();
	for(i=0;i<num;i++)
	{
		for(j=0;j<81;j++)
		{
			scanf("%c",&a[j]);
			if(a[j]=='\n')
			{
				break;
			}
		}
		
		if( (a[0]=='_') || (a[0]>='a' && a[0]<='z')
						|| (a[0]>='A' && a[0]<='Z') )
		{
			flag=1;
			for(k=1;k<j;k++)
			{
				if(    (a[k]=='_')
					|| (a[k]>='0' && a[k]<='9') 
					|| (a[k]>='a' && a[k]<='z')
					|| (a[k]>='A' && a[k]<='Z') )
					flag*=1;
				else
				{
					flag*=0;
					break;
				}
			}
			if(flag==1) printf("1\n");
			else printf("0\n");
		}
		else
		{
			printf("0\n");
		}
	}
	return 0;
}
main()
{
int n,i,j,len;
int a[100]={0};
char s[100]={0};

scanf("%d\n",&n);
fflush(stdin);
for(i=0;i<n;i++)
{
gets(s);
len = strlen(s);
j=0;
if(s[0]=='_'||('a'<=s[0]&&s[0]<='z')||('A'<=s[0]&&s[0]<='Z'))
{ 
 j = 1;
 while(j<len)
 {
             if(s[j]=='_'||('a'<=s[j]&&s[j]<='z')||('A'<=s[j]&&s[j]<='Z')||('0'<=s[j]&&s[j]<='9'))
  j++;
 else break;
  }
}
if(j==len)
a[i]=1;
else a[i]=0;
}
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}

}
int main()
{
	int i,n,k,t,j;
	char c[81];
    char*p;
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		gets(c);
        p=c;
		k=strlen(p);
		for(j=0;j<k;j++){
			if(*p>='0'&&*p<='9'){t=-1;break;}
		if((*(p+j)>='0'&&*(p+j)<='9')||(*(p+j)>='a'&&*(p+j)<='z')||(*(p+j)>='A'&&*(p+j)<='Z')||(*(p+j)=='_'))
		{
			t++;
		}else{t=-1;break;}
	}if(t==-1){printf("0\n");}
	else{printf("1\n");}
	}
	return 0;
}
int main()
{
	int n,i,m,mark;
	char a[81]={'\0'};
	char *p;
	scanf("%d",&n);
	gets(a);
	for(i=0;i<n;i++)
	{
		gets(a);
		m=strlen(a);
		for(p=a;*p!='\0';p++)
		{
			if((*p=='_')||(*p>='0'&&*p<='9')||(*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z'))
				mark=1;
			else {mark=0;
			break;
			}
		}
		p=a;
		if(*p>='0'&&*p<='9')
			mark=0;
		printf("%d\n",mark);
	}
	return 0;
}
int main()
{
	char a[81];
	int n, i, j;
	cin >> n;
	cin.get();
	for(i = 0;i < n;i++)
	{
		cin.getline(a, 81);
		if((a[0] >= 'A' && a[0] <= 'Z') || (a[0] >= 'a' && a[0] <= 'z') || a[0] == '_')
		{
			for(j = 0;a[j] != '\0';j++)
			{
				if((a[j] >= '0' && a[j] <= '9') || (a[j] >= 'A' && a[j] <= 'Z') || (a[j] >= 'a' && a[j] <= 'z') || a[j] == '_')
				{}
				else
				{
					break;
				}
			}
			if(a[j] == '\0')
			{
				cout << "1" << endl;
			}
			else
			{
				cout << "0" << endl;
			}
		}
		else
		{
			cout << "0" << endl;
		}
	}
	return 0;
}
/*
 * ????test4.cpp
 * ???1000012737
 * ????: 2010-11-20
 * ?????????????????????????,?????????????80?????
 * ???????????????????????1????????0????
 */

int main(){
	int n,t,k;//????
	cin>>n;//?????????n
	t=n;//?n????t
	int a[n+1];//????a??????
	while(n>=0){
		char s[81];//?????s
		int i,l,m=0;//??????
		cin.getline(s,81);//??????
		l=strlen(s);//?????????
		if((s[0]=='_')||(s[0]>='A'&&s[0]<='Z'||(s[0]>='a'&&s[0]<='z'))){
			for(i=1;i<l;i++){
				if(s[i]=='_'||(s[i]>='A'&&s[i]<='Z')||(s[i]>='a'&&s[i]<='z')||(s[i]>='0'&&s[i]<='9'))
					m++;
				else a[t-n]=0;
			}
		}
		else a[t-n]=0;//???????????????????????m???????????a?????0
		if(m==l-1)a[t-n]=1;//????????????????????a?????1
		n--;//n???????
	}
	for(k=1;k<=t;k++)
		cout<<a[k]<<endl;//??????
	return 0;//????
}
int main()
{
	int n,i,j,m;
	char c[800];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		gets(c);
		m=strlen(c);
		if((c[0]>=65&&c[0]<=90)||(c[0]>=97&&c[0]<=122)||(c[0]==95))
		{
			for(j=0;j<=m-1;j++)
			{
				if(c[j]==' ')
				{
					printf("0\n");break;
				}
				if(c[j]<48)
				{
					printf("0\n");break;
				}
				if(c[j]>57&&c[j]<65)
				{
					printf("0\n");break;
				}
				if(c[j]>91&&c[j]<95)
				{
					printf("0\n");break;
				}
				if(c[j]>95&&c[j]<97)
				{
					printf("0\n");break;
				}
				if(c[j]>122)
				{
					printf("0\n");break;
				}
			}
			if(j==m)
				printf("1\n");
		}
		else
			printf("0\n");
	}
	return 0;
}
int main()
{
	char * character,sz[81];
	int i,j,n,e;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		e=0;
		character=sz;
		gets(character);
		if(*character=='_'||(*character>=65&&*character<=90)||(*character>=97&&*character<=122))
		{
			for(; *character!='\0';++character)
			{
				if(*character=='_'||(*character>=65&&*character<=90)||
					(*character>=97&&*character<=122)||(*character>=48&&*character<=57))
					continue;
				else
				{
					printf("%d\n",0);
					e=1;
					break;
				}
			}
			if(e==0)
				printf("%d\n",1);
		}
		else
			printf("%d\n",0);
	}
	return 0;
}
int check(char n);
int main()
{
    int i=0,n=0;
    cin>>n;
    cin.get();
    for (i=0;i<n;i++)
    {
        int j=0;
        int k=0;
        int flag=0;
        char shuru[100]={0};
        cin.getline(shuru,100);
        if ((shuru[0]=='_')||((shuru[0]>='A')&&(shuru[0]<='Z'))||((shuru[0]>='a')&&(shuru[0]<='z')))
        {
             for (k=1;shuru[k]!='\0';k++)
             {
                 if (check(shuru[k])==0)
                 {
                     flag=1;
                     cout<<"0"<<endl;
                     break;
                 }
             }
             if (flag==0)
             cout<<"1"<<endl;
        }
        else
        cout<<"0"<<endl;
    }
    return 0;
    }
int check(char n)
{
    int c=0;
    if ((n=='_')||((n>='A')&&(n<='Z'))||((n>='a')&&(n<='z'))||((n<='9')&&(n>='0')))
    c=1;
    return c;
}
int main(){
	int n,i;
	char a[100];//a?????
	cin>>n;//n??????
	cin.getline(a,100);
	for(;n>0;n--){
		cin.getline(a,100);
		for(i=0;a[i]!=0;i++){
			if(i==0)
				if(a[i]!='_'&&(a[i]<'a'||a[i]>'z')&&(a[i]<'A'||a[i]>'Z'))break;
				else continue;
			else if(a[i]!='_'&&(a[i]<'a'||a[i]>'z')
					&&(a[i]<'A'||a[i]>'Z')&&(a[i]<'0'||a[i]>'9'))break;//???????????
		}
		if(a[i]==0)cout<<'1'<<endl;
		else cout<<'0'<<endl;
	}
	return 0;
}
/*
 * ?????C????????.cpp
 *
 *  Created on: 2010-11-24
 *      Author: lenovo
 */
int main()
{
	int n,i,j;
	char a[100];
	cin>>n;
	cin.get();
	for (i=1;i<=n;i++)
	{   int t=0;
		cin.getline (a,100,'\n');
		if (!((a[0]=='_')||(a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')))
			cout<<'0'<<endl;
		else
		{
			for (j=1;j<strlen(a);j++)
				if (!((a[j]=='_')||(a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||(a[j]>='0'&&a[j]<='9')))
				{
					cout << '0' <<endl;
				    t++;
				    break;
				}
			  if (t==0)
				cout << '1' <<endl;
		}
	}
	return 0;
}
int main()
{
	int n ,len;
	int flag[1000];
	int i, j, k, a;
	for(a = 0; a <1000; a++)
		flag[a] = 1;
	cin >> n;
	cin.get();
	char str[81];
	for(i = 1; i <= n; i++)
	{
		cin.getline(str, 81);
		len = strlen(str);
		for(j = 0; j < len; j++)
		{
			if(str[0] == '_' || (str[0] - 'a' < 26 && str[0] - 'a' >= 0) || (str[0] - 'A' < 26 && str[0] - 'A' >= 0))
			{
				if(str[j] == '_' || (str[j] - 'a' < 26 && str[j] - 'a' >= 0) || (str[j] - 'A' < 26 && str[j] - 'A' >=0) || (str[j] - '0' <= 9 && str[j] - '0' >= 0))
				{
				}
				else
				{
					flag[i] = 0;
					break;
				}
			}
			else
			{
				flag[i] = 0;
				break;
			}
		}
	}
	for(i = 1; i <= n; i++)
	{
		cout << flag[i] << endl;
	}
	return 0;
}
int main()
{
	int n,i=1,j,len;
	char s[81]={0};
	scanf("%d",&n);
	getchar();
	for(j=0;j<n;j++)
	{
	gets(s);
	if(s[0]=='_'||(s[0]>='A'&&s[0]<='Z')||(s[0]>='a'&&s[0]<='z'))
	{
		i=1;
		while(s[i]!='\0')
		{
			if((s[i]<'0'||(s[i]>'9'&&s[i]<'A')||(s[i]>'Z'&&s[i]<'a')||s[i]>'z')&&s[i]!='_')
			{
				printf("0\n");
				break;
			}
			i++;
		}
		if(s[i]=='\0')printf("1\n");
	}
	else
    printf("0\n");
}
return 0;
}
// ?????C????????.cpp : Defines the entry point for the console application.
// ??????????C????????
int main()
{
	char a[10000][81]={0};                      //?????????????????????????0
	int n,i=0,j=0;                              //????n????????????i?j?????0
	int num=0;                                  //????num???????????????????
	cin>>n;                                     //??n
	cin.get();                                  //??????????????
	for(i=0;i<n;i++)                            //?for?????????
	{
		cin.getline(a[i],81);
	}
	for(i=0;i<n-1;i++)
	{
		num=0;
		for(j=0;j<strlen(a[i]);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'))              //?????????????num????
				num++;
			else
			{
				cout<<"0"<<endl;               //??????0??????
				break;
			}
			if(num==strlen(a[i]))              //???????????????
			{
				if((a[i][0]>='A'&&a[i][0]<='Z')||(a[i][0]>='a'&&a[i][0]<='z')||a[i][0]=='_')       //?????????????????1
					cout<<"1"<<endl;
				else                              //????0??????
				{
					cout<<"0"<<endl;        
					break;
				}
			}
		}
	}
	num=0;
	for(j=0;j<strlen(a[n-1]);j++)             //????????????C????????
	{
		if((a[n-1][j]>='A'&&a[n-1][j]<='Z')||(a[n-1][j]>='a'&&a[n-1][j]<='z')||a[n-1][j]=='_'||(a[n-1][j]>='0'&&a[n-1][j]<='9'))
			num++;
		else
		{
			cout<<"0";
			break;
		}
		if(num==strlen(a[n-1]))
		{
			if((a[n-1][0]>='A'&&a[n-1][0]<='Z')||(a[n-1][0]>='a'&&a[n-1][0]<='z')||a[n-1][0]=='_')
					cout<<"1"<<endl;
				else
				{
					cout<<"0"<<endl;
					break;
				}
		}
	}
		return 0;
	}
int main()
{
	int i,j,n,b[100];
	char a[100][80];
	for (i=0;i<100;i++)
		b[i]=80;
	for (i=0;i<80;i++)
		for (j=0;j<80;j++)
			a[i][j]='\0';
	cin>>n;
	cin.get();
	for (i=0;i<n;i++)
	{
		for (j=0;j<80;j++)
		{
			cin.get(a[i][j]);
			if (a[i][j]==10)
			{
				b[i]=j;
				break;
			}
			if (j==79)
				cin.get();
		}
		if (!((a[i][0]>=65&&a[i][0]<=90)||(a[i][0]>=97&&a[i][0]<=122)||a[i][0]==95))
			cout<<0<<endl;
		else if ((b[i]==1)&&((a[i][0]>=65&&a[i][0]<=90)||(a[i][0]>=97&&a[i][0]<=122)||a[i][0]==95))
			cout<<1<<endl;
		else
		{
			for (j=1;j<b[i];j++)
			{
				if (!((a[i][j]>=48&&a[i][j]<=57)||(a[i][j]>=65&&a[i][j]<=90)||(a[i][j]>=97&&a[i][j]<=122)||a[i][j]==95))
				{
					cout<<0<<endl;
					break;
				}
				if (j==b[i]-1)
					cout<<1<<endl;
			}
		}
	}
	return 0;
}
/*
 * ????review(11).cpp
 * ??????
 * ????: 2010-12-17
 * ?????????????????????????????????????????1?????0?
 */

int main(){
	int n;//?????????????
	char s[81];//?????
	cin>>n;//?????????
	cin.getline(s,81);
	while(n>0){
		int l,i;//????
		cin.getline(s,81);//???????
		l=strlen(s);//??????????l
		if(s[0]=='_'||(s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z')){
			for(i=1;i<l;i++){
				if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')||(s[i]>='0'&&s[i]<='9')||s[i]=='_')
					continue;//??????????????????
				else {
					cout<<'0'<<endl;
					break;//???????0?????
				}
			}
			if(i==l)cout<<'1'<<endl;//?????????????1
		}
		else cout<<'0'<<endl;//??????????????0
		n--;//n???????
	}
	return 0;//????
}
int main()
{
	int n,i,j,len,sign;
	scanf("%d",&n);
	getchar();
	char a[81];
    for(i=1;i<=n;i++)
	{
		gets(a);
		len=strlen(a);
		sign=1;
		if(a[0]!=95&&isalpha(a[0])==0)sign=0;	
        for(j=1;j<len;j++)
		{	if(isalnum(a[j])==0&&a[j]!=95)sign=0;}
		printf("%d\n",sign);
	}
	return 0;
}
int main()
{
	char a[100];
	int n;
	cin >> n;
	cin.get();
	for(int i=0; i < n; i++)
	{
		cin.getline(a,100);
		int l;
		l = strlen(a);
		int t = (int)a[0];
		if((t <= 90 && t >= 65) || (t <= 122 && t >= 97) || t == 95)
		{
			int j;
			for(j=1; j < l; j++)
			{
				if((a[j] > 90 || a[j] < 65)  && (a[j] > 122 || a[j] < 97) && a[j] != 95 && (a[j] < 48 || a[j] > 57))
				{
					cout<<0<<endl;
					break;
				}
				else
				{
					continue;
				}
			}
			if(j == l)
			{
				cout << 1 <<endl;
			}

		} 
		else
		{
			cout<<0<<endl;
		}
	}
return 0;
}
int main()
{
	char a[82],*p=a;
	int n,i,j,k,l;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		gets(a);
		l=strlen(a);
		k=0;
		for(j=0;j<l;j++)
		{
			if(j==0 && ((*(p+j)>='A' && *(p+j)<='Z') || (*(p+j)>='a' && *(p+j)<='z') || *(p+j)=='_'))
				k++;
			if(j!=0 && ((*(p+j)>='0' && *(p+j)<='9') || (*(p+j)>='A' && *(p+j)<='Z') || (*(p+j)>='a' && *(p+j)<='z') || *(p+j)=='_'))
				k++;
		}
		if(k==l)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int main() 
{
	int i,j,n,k;
	char c;
	scanf("%d\n",&n);
	char *p[100];
	for(i=0;i<n;i++)
	{
		p[i]=(char *)malloc(100*sizeof(char));
		gets(p[i]);
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<strlen(p[i]);j++)
		{
			k=1;
			c=*(*(p+i)+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\n",k);
	}
	return 0;

}
int main()
{
	int n, i, len ;
	char str[1000];
	cin >> n;
	cin.get();
	while(n--)
	{
		cin.getline(str,1000);
		len = strlen(str);
		if(str[0]=='_'||(str[0]>='a'&&str[0]<='z')||(str[0]>='A'&&str[0]<='Z'))
		{
			if(len==1)
				cout << "1" << endl;
			else
			{
				for(i=1;i<len;i++)
				{
					if(str[i]=='_'||(str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z')||(str[i]<='9'&&str[i]>='0'));
					else
						break;
				}
				if(i==len)
					cout << "1" << endl;
				else 
					cout << "0" << endl;
			}
		}
		else
			cout << "0" << endl;
		
	}
	return 0;
}