semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()//?????c?????? 
{
    int n,i,j,check=1;//n????check???????? 
    char test[100][90];//????? 
    cin>>n;getchar(); //??n???????? 
    for(i=0;i<n;i++)gets(test[i]);//???????  
    for(i=0;i<n;i++)
    {
                     
                    check=1;//??? 
                    if(!((test[i][0]=='_')||(test[i][0]>='a'&&test[i][0]<='z')||(test[i][0]>='A'&&test[i][0]<='Z')))check=0;//??????????? 
                    j=1;
                    while(test[i][j]!=0)
                    {
                                         if(!((test[i][j]=='_')||(test[i][j]>='a'&&test[i][j]<='z')||(test[i][j]>='A'&&test[i][j]<='Z')||(test[i][j]>='0'&&test[i][j]<='9')))check=0;//?????????????? 
                                         j++; 
                    }
                    cout<<check<<endl;//????? 
    }
    getchar();
    getchar();
    return 0;
}
int main()
{
    int n,i,j;
    char a[100];
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++)
    {
                    gets(a);
                    if((a[0]=='_')||((a[0]>='A')&&(a[0]<='Z'))||((a[0]>='a')&&(a[0]<='z')))
                    {
                             for(j=1;j<strlen(a);j++)
                             {
                                                     if((a[j]<48)||((a[j]>=58)&&(a[j]<=64))||((a[j]>=91)&&(a[j]<=94))||(a[j]==96)||(a[j]>=123))
                                                     {printf("0\n");
                                                     break;}
                             }
                             if(j==strlen(a))
                             printf("1\n");
                    }                                                           
                    else
                    {
                        printf("0\n");
                    }
    }
    getchar();
    getchar();
}
/*
 * y3.cpp
 *
 *  Created on: 2010-11-26
 *      Author: ???
 *      Function??????C????????     
 */
int main(){                           // ???      
	char a[81];
	int n,p1,p2,p3,q,b=0,i,l,t;       //????
	cin>>n;                           //???????
	cin.getline(a,81);                //?cin.getline?????
	while(n>0)                        
	{cin.getline(a,81);              //?????
	 l=strlen(a);                      //????
	 if(l==1) b=1;                      
	 else  {                          
		    for(i=1;i<l;i++)           //???????????????????????
	        { t=a[i];                  //??????????????1??????0
	             p1=(t>='a')&&(t<='z');
	        	 p2=(t>='A')&&(t<='Z');
	        	 p3=(t>='0')&&(t<='9');
	        	 q=(t=='_');
		     if(p1||p2||p3||q)
		    	 b=1;
	         else {b=0;break;}
	         }}
	  t=a[0];
	     p1=(t>='a')&&(t<='z');
	  	 p2=(t>='A')&&(t<='Z');
	  	 p3=(t>='0')&&(t<='9');
	  	 q=(t=='_');
	  if((p1||p2||q)&&b)
		 cout<<1<<endl;
	 else cout<<0<<endl;
	 n--;
	}
	return 0;
}
main()
{
      char s[900];
      int i,n,j;
      
      scanf("%d",&n);
      gets(s);
      for (i=0;i<n;i++)
      {
          gets(s);
          j=0;
          if ((s[j]=='_') || (s[j]>='a' && s[j]<='z') || (s[j]>='A' && s[j]<='Z'))
          {
              if (strlen(s)>0)
              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'))
                      continue;
                  else
                      break;
              if (j==strlen(s))
                  printf("1\n");
              else
                  printf("0\n");
          }
          else
              printf("0\n");
          
      }
 }
int main()
{
	int n,i,j,k;
	cin >> n;
	cin.get();
	while(n >= 1)
	{
		n--;
		char str[102];
		cin.getline(str,102);
		int len,i,j,k;
		len = strlen(str);
		if(str[0] != '_')
			if((str[0] < 'A')||(str[0] > 'z')||((str[0] > 'Z')&&(str[0] < 'a')))
				cout << "0" << endl;
		if((str[0] == '_')||((str[0] >= 'A')&&(str[0] <= 'Z'))||((str[0] >= 'a')&&(str[0] <= 'z')))
		{
		for(i = 0; i < len; i++)
		{
			if((str[i] < '0')||((str[i] > 'Z')&&(str[i] < 'a'))||(str[i] > 'z'))
				if(str[i] != '_')
				break;
		}
		if(i != len)
			cout << "0" << endl;
		if(i == len)
			cout << "1" << endl;
		}
	}
	return 0;
}
int main()
{
	char str[81];
	int n=0,i=0,j=0,J=0;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(str,81);
		int sum1=0,sum2=0,sum3=0,sum4=0;
		int p=0;	
		for(j=0;str[j]!='\0';j++)
			J=j;
		for(j=0;j<=J;j++)
		{
			sum1=(str[j]==95);
			sum2=(str[j]>=65&&str[j]<=90);
			sum3=(str[j]>=97&&str[j]<=122);
			sum4=(str[j]>=48&&str[j]<=57);
			if(sum1+sum2+sum3+sum4==0)
				p++;
		}
		
			sum1=(str[0]==95);
			sum2=(str[0]>=65&&str[j]<=90);
			sum3=(str[0]>=97&&str[j]<=122);
			if(sum1+sum2+sum3==0||p!=0)
				cout<<0<<endl;
			if(sum1+sum2+sum3!=0&&p==0)
				cout<<1<<endl;

	}
	return 0;
}
int panduan(char *p)
{
	int z=1,i,j,k;
	if(!(((*p>='a')&&(*p<='z'))||((*p>='A')&&(*p<='Z'))||(*p=='_')))
		z=0;
	else
	{
		for(i=1;*(p+i)!='\0';i++)
		{
			if(!(((*(p+i)>='a')&&(*(p+i)<='z'))||((*(p+i)>='A')&&(*(p+i)<='Z'))||(*(p+i)=='_')||(*(p+i)>='0'&&*(p+i)<='9')))
			{
				z=0;
				break;
			}
		}
	}
	return (z);
}
void main()
{
	int panduan(char *p);
	int m,n,i,j,k;
	char *p,**q,**Q;
	scanf("%d\n",&m);
	q=(char**)malloc(m*sizeof(char*));
	Q=q;
	for(i=0;i<m;i++)
	{
		p=(char*)malloc(80*sizeof(char));
		for(j=0;j<80;j++)
		{
			*(p+j)='\0';
		}
		gets(p);
		*q=p;
		q++;
	}
	for(i=0;i<m;i++,Q++)
	{
		printf("%d\n",panduan(*Q));
	}
}
int main()
{
	int n, i, j, n1;
	char str[200];
	cin >> n;
	cin.get();
	for (i = 1; i <= n; i++)
	{
		 j = 1;
		cin.getline(str,120);
		n1 = strlen(str);
		if (!((str[0] == '_') || ((str[0] >= 'a') && (str[0] <= 'z')) || ((str[0] >= 'A') && (str[0] <= 'Z'))))
		{
			cout << 0 << endl;
			continue;
		}
		for (j = 1; str[j] != 0; j++)
		{
			if (((str[j] >= 'a') && (str[j] <= 'z')) || ((str[j] >= '0') && (str[j] <= '9')) || (str[j] == '_') || ((str[j] >= 'A') && (str[j] <= 'Z')))
				continue;
			else
				break;
		}
		//if (j == n1)
		if (str[j] == 0)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}

	return 0;
}
int c(char a[8000])
{
    int i,l,z=0;
    l=strlen(a);
    for(i=0;i<l;i++)
    {
                    if(a[i]=='_')
                    z=0;
                    else if(a[i]>='A'&&a[i]<='Z')
                    z=0;
                    else if(a[i]>='a'&&a[i]<='z')
                    z=0;           
                    else if(a[i]>='0'&&a[i]<='9')
                    z=0;
                    else
                    {
                        z=1;
                        break;
                    }
    }
                    return z;
}
main()
{
      char a[8000];
      int n,i;
      scanf("%d",&n);
      gets(a);
      for(i=0;i<n;i++)
      {
                      gets(a);
                      if(c(a)==1)
                      printf("0\n");
                      else if(a[0]=='_')
                      printf("1\n");
                      else if(a[0]>='A'&&a[0]<='Z')
                      printf("1\n");
                      else if(a[0]>='a'&&a[0]<='z')
                      printf("1\n");
                      else
                      printf("0\n");
      }
      getchar();
      getchar();
}
void main()
{
	char *p,c;
	int n,i,j,k,l,m,z;
	scanf("%d\n",&n);
	for (z=0;z<n;z++)
	{
		p=(char *)malloc(1000*sizeof(char));
		gets(p);
		l=strlen(p);
		k=1;
		if (!(*p=='_'||(*p<='Z'&&*p>='A')||(*p<='z'&&*p>='a')))
		{
			printf("0\n");
			continue;
		}
		for (i=1;i<l;i++)
		{
			c=*(p+i);
			if (!(c=='_'||(c<='Z'&&c>='A')||(c<='z'&&c>='a')||(c<='9'&&c>='0')))
			{ 
			printf("0\n");
			k=0;
			break;
			}
		}
		if(k) printf("1\n");
		free(p);
	}
}
main()
{
      int n,l,p1,p2,p3,p4,c=2;
      char a[100];
      scanf("%d",&n);getchar ();
      for(int i=1;i<=n;i++)
      {
              
              gets (a);
              l=strlen(a);
              p1=a[0]-'_';p2=a[0]-'a';p3=a[0]-'A';
              if(p1==0||(p2<=26&&p2>=0)||(p3<=26&&p3>=0))
                  {
                            if(l>=2)
                            {
                                    for(int j=1;j<l;j++)
                                    {
                                    p1=a[j]-'_';p2=a[j]-'a';p3=a[j]-'A';p4=a[j]-'0';
                                    if(p1==0||p2<=26&&p2>=0||p3<=26&&p3>=0||p4>=0&&p4<=9)
                                    c=1;
                                    else
                                    {c=0;break;}
                                    }
                            }
                            else
                            printf("1\n");
                            
                  }
              if(c==1)
                  printf("1\n");
              else
                 { 
                  if(l!=1)
              printf("0\n");}
              c=2;
      }
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
int main()
{ int n,i,j,flag=1;
  char a[81];
  cin>>n;cin.get();
  for(i=1;i<=n;i++)
  {cin.getline(a,81);
   if(!(a[0]>='a'&&a[0]<='z'||a[0]>='A'&&a[0]<='Z'||a[0]=='_')) 
       {cout<<0<<endl;continue;}//?????
   else{ for(j=1;a[j]!='\0'&&flag;j++)
          if(!(a[j]>='a'&&a[j]<='z'||a[j]>='A'&&a[j]<='Z'||a[j]=='_'||a[j]>='0'&&a[j]<='9')) //???????
              flag=0;
         cout<<flag<<endl;
       }
    flag=1;
  }
  return 0;
}
int main()
{
	char a[80];
	int n,i,k=0;
	scanf("%d\n",&n);
	while (n>0)
	{
		k=0;
		gets(a);
		if ((a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')||(a[0]=='_'))
		{
			for (i=1;i<=79;i++)
			{
				if(a[i]==0) break; 
				if (!((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')||(a[i]>='0'&&a[i]<='9')||(a[i]=='_')))
				 {printf("0\n");k+=1;break;}
			}
			if (k==0) printf("1\n");
		}
		else printf("0\n");
		n--;
		memset(a, 0, 20);

	}
	return 0;
}
int main()
{
    int print(char m[]);
    int n;
    char a[81],ch;
    cin>>n;
    ch=cin.get();        //????????? 
    for(int j=0;j<n;j++)
    {
      cin.getline(a,81); //????????????? 
      cout<<print(a)<<endl;
    }
    return 0;
}
int print(char m[])   //????????? 
{                      //??????1??????0 
    if(!((m[0]=='_')||(m[0]>64&&m[0]<91)||(m[0]>96&&m[0]<123)))return 0;
    int i=1;
    while(m[i]!='\0')
    {
      if(!((m[i]=='_')||(m[i]>64&&m[i]<91)||(m[i]>96&&m[i]<123)
           ||(m[i]>47&&m[i]<58)))return 0;
      i++;
    }
    return 1;

}
int Judge(char c)
{
	int i, flag = 0;
	for (i = 0; i < 26; i ++)
		if (c == 'a' + i || c == 'A' + i)
		{
			flag = 1;
			break;
		}
	for (i = 0; i < 10; i ++)
		if (c - '0' == i)
		{
			flag = 1;
			break;
		}
	if (c == '_')
		flag = 1;
	return flag;
	
}

int main()
{
	int n, i, j, l, k;
	char a[81];
	cin >> n;
	cin.get();
	for (i = 0; i < n; i ++)
	{
		cin.getline(a, 81);
		l = strlen(a);
		for (j = 0; j < l; j ++)
			if (!Judge(a[j]))
			{
				cout << 0 << endl;
				break;
			}
		if (j == l)
		{
			for (k = 0; k < 10; k ++)
				if (a[0] - '0' == k)
				{
					cout << 0 << endl;
					break;
				}
			if (k == 10)
				cout << 1 << endl;
		}
	}
	return 0;
}
int main()
{
	int n, i, j;
	char str[100][81];
	cin >> n;
	cin.get();
	for ( i = 0; i < n; i++ )
	{
		cin.getline( str[ i ], 81 );
	}
	 for ( i = 0; i < n; i ++ )
	 {
		 if ( str[ i ][0 ] == '_' ||( str[ i][ 0 ] >= 'a' && str[ i ][ 0 ] <= 'z' ) || (str[ i][ 0 ] >='A' && str[ i][ 0 ] <='Z' ) )
		 {
			 for ( j = 1; j < strlen( str[ i ] ); j++ )
			 {
				 if ( str[ i][j] =='_' || (str[ i ][ j ] >= 'a' && str[ i ][ j ] <= 'z' ) || ( str[ i][ j] >='A' && str[ i][ j ] <='Z') ||
					 (str[ i][ j ] >= '0' && str[ i][ j ] <='9' ) )
				 {
				 }
				 else
				 {
					 break;
				 }
			 }
			 if ( j == strlen( str[ i ] ) )
			 {
				 cout << 1 << endl;
			 }
			 else 
			 {
				 cout << 0 << endl;
			 }
		 }
		 else 
		 {
			 cout << 0 << endl;
		 }
	 }
}
int main()
{
    int n=0,i=0,len=0;
    scanf("%d\n", &n);
    char str[100];
    //fgets(str, 100, stdin);
    while(i<n)
    {
        i++;
        fgets(str, 100, stdin);
        //printf("%s", str);
        len = strlen(str) - 1;
        if(str[0]=='_'||isalpha(str[0]))
            for(int j=0;j<len;j++)
            {
                if(!(str[j]=='_'||isalpha(str[j])||isdigit(str[j])))
                {
                    cout<<"0"<< endl;
                    break;
                }
                else
                    if(j==len-1) cout<<"1"<<endl;
            }
        else  cout<<"0"<<endl;
    }
    return 0;
}
int main()
{
    int i,j,n,cnt=0;
    char s[800],temp[800];
    scanf("%d",&n);
    gets(temp);
    int a[n];
    for(i=0;i<n;i++)
    {
        gets(s);
        //gets(temp);
        a[i]=strlen(s);
        cnt=0;
        if((s[0]>='0' && s[0]<='9'))
            printf("0\n");
        else
        {
            for(j=0;j<a[i];j++)
            {
                if(!((s[j]=='_')||(s[j]>='A' && s[j]<='Z')||(s[j]>='a' && s[j]<='z')||(s[j]>='0' && s[j]<='9' && j>0)))
                {    
                    printf("0\n");
                    break;
                }
                else
                {
                    cnt++;
                }    
            }
        }
        if(cnt==a[i])
        {
            printf("1\n");
        }
    }
    getchar();
    //getchar();
    return 0;
}
int main()
{
int n,i,j,k;
char **p,c;

scanf("%d",&n);
c=getchar();
p=(char **)malloc(sizeof(char*)*1000);

for(i=0;i<n;i++)
{
		*(p+i)=(char*)malloc(sizeof(char)*80);
		gets(*(p+i));
}

for(i=0;i<n;i++)
{
	j=0;
	k=0;
	if(      ( *(*(p+i)+k)=='_'  )   ||    (   (*(*(p+i)+k)<=90)&&(*(*(p+i)+k)>=65)  )  ||   (   (*(*(p+i)+k)<=122)&&(*(*(p+i)+k)>=97)  ))    
	{
		do
		{
			if(      (  *(*(p+i)+k)=='_'  )   ||  (   (*(*(p+i)+k)>=48)&&(*(*(p+i)+k)<=57)  )  ||  (   (*(*(p+i)+k)<=90)&&(*(*(p+i)+k)>=65)  )  ||   (   (*(*(p+i)+k)<=122)&&(*(*(p+i)+k)>=97)  )   ) 		
			{
				j=1;
			}
			else {j=0;break;}			
            k++;
			if(j==0) break;
		}
		while(  *(*(p+i)+k)!='\0' );
	}
	printf("%d\n",j);
}
return 0;
}
void main(){
	int n,i,j,judge;
	char zfc[81],*pzfc;
	pzfc=zfc;
	scanf("%d",&n);
	gets(zfc);     //??????????????????????
	for(i=0;i<n;i++){
		gets(zfc);
		j=0;
		judge=0;
		while(*(pzfc+j)!='\0'){
			if(j==0){
				if(*(pzfc+j)!='_'&&(*(pzfc+j)<'A'|*(pzfc+j)>'z')){
					judge=1;
					break;
				}
			}
			else{
				if((*(pzfc+j)<'A'||*(pzfc+j)>'z')&&(*(pzfc+j)<'0'||*(pzfc+j)>'9')){
					judge=1;
					break;
				}
			}
			j++;
		}
		if(judge)
			printf("0\n");
		else
			printf("1\n");
	}
}
int main()
{
	char sen[81]={0};
	int i,j=0,n;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		j=0;
		cin.getline(sen,81);
		while(sen[j]=='_'||(sen[j]>='A'&&sen[j]<='Z')||(sen[j]>='a'&&sen[j]<='z')||(sen[j]>='0'&&sen[j]<='9'))
		{
			if((sen[0]>='0'&&sen[0]<='9'))
				break;
			j++;
		}
		if(j==strlen(sen))
			cout<<1<<endl;
		else
			cout<<0<<endl;

	}


	return 0;
}
int main()
{
	int n;
	cin>>n;
	char str[100][81];
	int i,j;
	for(i=0;i<n;i++)
	{
		cin.get();
		cin.get(str[i],81);
	}
	for(i=0;i<n;i++)
	{
		int flag=0;
		if(str[i][0]=='_' || (str[i][0]>='a' && str[i][0]<='z') || (str[i][0]>='A' && str[i][0]<='Z'))
		{
			j=1;
			flag=1;
			while(str[i][j]!='\0')
			{
				if(str[i][j]=='_' || (str[i][j]>='a' && str[i][j]<='z') || (str[i][j]>='A' && str[i][j]<='Z') || (str[i][j]>='0' && str[i][j]<='9'))
				{
					flag=1;
				}
				else
				{
					flag=0;
					break;
				}
				j++;
			}
		}
		cout<<flag<<endl;
	}
	return 0;
}
int main()
{
	char *p,str[81];
	int rd,n;
	scanf("%d",&n);
	getchar();
	for(rd=0;rd<n;rd++)
	{
		gets(str);
		p=str;
		for(;p<&str[strlen(str)];p++)
		{
			if(!(Check)&&p==str)
			{
				printf("0\n");
				break;
			}else{
				if(!(Check||(*p>='0'&&*p<='9')))
				{
					printf("0\n");
					break;
				}else if(p==&str[strlen(str)-1]){
					printf("1\n");
				}
			}
		}
	}
	return 0;
}
int check(char *p)
{
	if((*p=='_')||(*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z'))
	{
		int i;
		for(i=0;*(p+i)!='\0';i++)
		{
			if((*(p+i)=='_')||(*(p+i)>='a'&&*(p+i)<='z')||(*(p+i)>='A'&&*(p+i)<='Z')||(*(p+i)>='0'&&*(p+i)<='9'));
			else break;
		}
		if(*(p+i)=='\0')return(1);
		else return(0);
	}
	else return(0);
}

void main()
{
	int n;
	scanf("%d\n",&n);
	char *p[n];
	int i;
	for(i=0;i<n;i++)
	{
		p[i]=(char *)malloc(512*sizeof(char));
		gets(p[i]);
	}
	for(i=0;i<n;i++)
	printf("%d\n",check(p[i]));
}
int f(char word[81])
{
	int i,signal=1;
	
		for(i=0;word[i];i++)
		{
			if((word[i]=='_')||(word[i]<='Z'&&word[i]>='A')||(word[i]>='a'&&word[i]<='z')||(word[i]>='0'&&word[i]<='9'&&i>0))
				continue;
			else 
			{
				signal=0;
				break;
			}
		}
		if(signal==1)
			return 1;
		else 
			return 0;

}

int main()
{
	char word[81];
	int n,i;
	cin >>n;
	for(i=0;i<n+1;i++)
	{
		cin.getline(word,81,'\n');
		if(i!=0)
			cout <<f(word)<<endl;
	}
	return 0;
}
main()
{
      int n,i,j,count=0,l;
      scanf("%d",&n);
      char s[n][80];
      char string[80];
      gets(string);
      for(i=0;i<n;i++)
      {
            gets(s[i]);
            l=strlen(s[i]);
            for(j=0;j<l;j++)
            {
                if(j==0)
                {
                    if((s[i][j]=='_')||(s[i][j]>='a'&&s[i][j]<='z')||(s[i][j]>='A'&&s[i][j]<='Z'))
                     count++;
                }
                else
                {
                    if((s[i][j]=='_')||(s[i][j]>='a'&&s[i][j]<='z')||(s[i][j]>='A'&&s[i][j]<='Z')||(s[i][j]>='0'&&s[i][j]<='9'))
                      count++;
                }                               
            }
            if(count==l)
                 printf("1\n");
            else
                 printf("0\n");
                count=0;
      }
      getchar();
      getchar();
}
int stri(char*);
int main()
{
    char str[1000][1000];
    char *p[1000],*p0;
    int n,i,flag;
    
    scanf("%d",&n);
    for (i=0;i<=n;i++){
        gets(str[i]);
        p[i] = str[i];
    }
    
    for (i=1;i<=n;i++){
        p0 = p[i];
        if(*p0<'A'||*p0>'z'||(*p0>'Z'&&*p0<'a'&&*p0!='_')){
           printf("0\n");
           continue;
        }
        else{
            if (stri(p0)==1) printf("1\n");
            else printf("0\n");
		}
    }
}

int stri(char *str){
    char *pi;
    for (pi=str;*pi!='\0';pi++){
        if (*pi<48||*pi>'z'||(57<*pi&&*pi<65)||(*pi>'Z'&&*pi<'a'&&*pi!='_')){
           return 0;
           break;
        }
    }
    if (*pi=='\0') return 1;
}
int main()
{
	int n,i,temp=1;
	char s[200][85];
	scanf("%d",&n);
	gets(s[0]);
	for(;n>0;n--)
	{
		temp=1;
		gets(s[n]);
		if((s[n][0]==95)||((s[n][0]<123)&&(s[n][0]>96))||((s[n][0]<91)&&(s[n][0]>64))) ;
		else 
		{
			printf("0\n");
			continue;
		}
		for(i=1;s[n][i]!='\0';i++)
		{
			if((s[n][i]==95)||((s[n][i]<123)&&(s[n][i]>96))||((s[n][i]<91)&&(s[n][i]>64))||((s[n][i]<58)&&(s[n][i]>47))) ;
			else 
			{
				printf("0\n");
				temp=0;
				break;
			}
		}
		if(temp)
			printf("1\n");
	}
	return 0;
}
int main()
{
    
    int n;
    int i,j,l;
    char a[100];
    scanf("%d",&n);
    getchar();
    
    for(i=0;i<n;i++)
    {
       gets(a);
       l=strlen(a);
       if(!((a[0]>='A'&&a[0]<='Z')||(a[0]>='a'&&a[0]<='z')||a[0]=='_'))
         {
         printf("0\n");
         }
       else
       {
           for(j=1;j<l;j++)
           {
           if(!((a[j]>='0'&&a[j]<='9')||(a[j]>='A'&&a[j]<='Z')||(a[j]>='a'&&a[j]<='z')||a[j]=='_'))
             {
             printf("0\n");
             j=l+1;
             }
           }
           if(j==l)
            printf("1\n");
       }
    }
    
    getchar();
    getchar();
    getchar();
    
}
int main()
{
	int n,i,j,length;
	char a[100];
	cin>>n;
	cin.getline(a,90);
	for(i=1;i<=n;i++)
	{
		cin.getline(a,90);
		length=strlen(a);
		for(j=0;j<length;j++)
		{
			if(!((a[0]=='_')||((a[0]>='a')&&(a[0]<='z'))||((a[0]>='A')&&(a[0]<='Z'))))
			{
				cout<<0<<endl;
				break;
			}
			else
			{
				for(j=1;j<length;j++)
				{
					if(!(((a[j]=='_'))||((a[j]>='0')&&(a[j]<='9'))||((a[j]>='a')&&(a[j]<='z'))||((a[j]>='A')&&(a[j]<='Z'))))
					{
						cout<<0<<endl;
						break;
					}
				}
				if(j==length)
				{
					cout<<1<<endl;
				}
				break;
			}


		}
	}
	return 0;

}
void main()
{
	int i=0,j=0,l=0,n=0;
	char str[100]={0};
	scanf("%d",&n);
	gets(str);
	for(;i<n;i++)
	{
		gets(str);
		l=strlen(str);
		if(str[0]=='_'||(str[0]>='A'&&str[0]<='Z')||(str[0]>='a'&&str[0]<='z'))
		{
			for(j=0;j<l;)
			{
				if((str[j]>='0'&&str[j]<='9')||(str[j]=='_')||(str[j]>='A'&&str[j]<='Z')||(str[j]>='a'&&str[j]<='z'))
				{
					j++;
				}
				else
				{
					printf("0\n");
					break;
				}
				if(j==l)
				{
					printf("1\n");
					break;
				}
			}
		}
		else
			printf("0\n");
	}
}
void main()
{
	int n,i,j,k;
	char *p,*p0,c;
	p=p0=(char *)malloc(100*100*sizeof(char));
	scanf("%d",&n);
	gets(p);
	for(i=0;i<n;i++)
	{
		gets(p);
		k=1;
		for(p=p0,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()
{
	char a[150][80];
	int n,i,j,len_a,g;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		gets(a[i]);
		if((a[i][0]=='_')||(a[i][0]>='A')&&(a[i][0]<='Z')||(a[i][0]>='a')&&(a[i][0]<='z'))
		{
			g=0;
			len_a=strlen(a[i]);
			for(j=1;j<len_a;j++)
			{
				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'))
					continue;
				else
				{
					g=1;
					break;
				}
			}
			if (g==0) cout<<1<<endl;
			else cout<<0<<endl;
		}
		else  cout<<0<<endl;
	}
	return 0;
}
int main()
{
    char a[99];
    int n=0;
    int b[99]={0};
    cin>>n;
    cin.get();
    for(int i=0;i<n;i++)
       {
        cin.getline(a,90);
        if((a[0]=='_')||(a[0]==' ')||(a[0]==32)||((a[0]>=65)&&(a[0]<=90))||((a[0]>=97)&&(a[0]<=122)))
           b[i]=1;
        for(int j=0;j<strlen(a);j++)
           if(a[j]==' ')
              b[i]=0;
           for(int m=0;m<strlen(a);m++)
              if(!(((a[m]>=65)&&(a[m]<=97))||((a[m]>=97)&&(a[m]<=122))||((a[m]>=48)&&(a[m]<=57))||(a[m]==' ')))
               b[i]=0;
        }
    for(int k=0;k<n;k++)
       cout<<b[k]<<endl;
    return 0;
}
int main()
{
	int n,i,j,w;
	char s[100][81];
	char str[100];
	gets(str);
	n=atoi(str);
	for(w=0;w<n;w++)
	{
		gets(s[w]);
	}
	for(i=0;i<n;i++)
	{
		int flag=1;
		for(j=0;j<strlen(s[i]);j++)
		{
			if(s[i][0]!='_'&&(s[i][0]<'A'||(s[i][0]>'Z'&&s[i][0]<'a')||s[i][0]>'z'))
			{
				flag=0;
				break;
			}
			if(s[i][j]==' ')
			{
				flag=0;
				break;
			}
			if(!(s[i][j]=='_'||(s[i][j]>='A'&&s[i][j]<='Z')||(s[i][j]>='a'&&s[i][j]<='z')||s[i][j]>='0'&&s[i][j]<='9'))
			{
				flag=0;
				break;
			}
		}
		if(flag==0)
		{
			printf("0");
		}
		else
			printf("1");
		printf("\n");
	}
	

	return 0;
}
int main()
{
   int n,i,j,q,l;
   char sr[1],a[100];
   gets(sr);
   n=atoi(sr);
   for(i=1;i<=n;i++)
   {
      gets(a);
      l=strlen(a);
      if(a[0]=='_'||(a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')) 
        q=1; 
        else q=0;
        if(q==1)
        for(j=1;j<l;j++)
        {
         if(a[j]=='_'||(a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||(a[j]>='0'&&a[j]<='9'))
         q=1;
         else 
         {
              q=0;
              break;
              } 
       }  
             
              printf("%d\n",q);
              }
              getchar();
              getchar();
              }
main()
{
      int s,i,j;
      char q[10000][100];
      char *p[10000];
      void test(char *p);
      scanf("%d\n",&s);
      for(i=1;i<=s;i++) {gets(q[i]);}
      for(i=1;i<=s;i++) {p[i]=q[i];test(p[i]);}

}

void test(char *p)
{
    int t,m=0,n=0,i,b;
    b=strlen(p);
    for(i=0;i<b;i++) {if((*(p+i)=='_')||(*(p+i)>='a'&&*(p+i)<='z')||(*(p+i)>='A'&&*(p+i)<='Z')||(*(p+i)<='9'&&*(p+i)>='0')) m=m+1;}
    if((*p=='_')||(*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')) n=1;
    if(n>0&&m==b) t=1;
    else t=0;
    printf("%d\n",t);
}
int main()
{
	int n;
	cin >> n;
	cin.get();
	for (int i=1;i<=n;i++)
	{
		char str[85];
		int flag=0,len=0,l;
		cin.getline(str,85);
		l=strlen(str);
		if ((str[0]=='_')||(str[0]>='a'&&str[0]<='z')||(str[0]>='A'&&str[0]<='Z'))
		{
			for (int t=1;str[t]!='\0';t++)
			{
				if ((str[t]=='_')||(str[t]>='a'&&str[t]<='z')||(str[t]>='A'&&str[t]<='Z')||(str[t]>='0'&&str[t]<='9'))
				{
					len++;
				}
			}
			if (len==l-1)
				cout << "1" << endl;
			else
				cout << "0" << endl;
		}
		else
				cout << "0" << endl;
	}
	return 0;
}