semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int i,j,n,m;
	char *p[100];
	scanf("%d\n",&n);
	for (i=0;i<n;i++)
		*(p+i)=(char *)malloc(80*sizeof(char));
	for (i=0;i<n;i++)
		gets(*(p+i));
	for (i=0;i<n;i++)
	{
		m=0;
		if (!((*(*(p+i))=='_')||((*(*(p+i))>=65)&&(*(*(p+i))<=90))||((*(*(p+i))>=97)&&(*(*(p+i))<=122))))
			m=1;
		else
		{
			for (j=0;j<strlen(*(p+i));j++)
			{
				if (!((*(*(p+i)+j)=='_')||((*(*(p+i)+j)>=65)&&(*(*(p+i)+j)<=90))||((*(*(p+i)+j)>=97)&&(*(*(p+i)+j)<=122))||((*(*(p+i)+j)>=48)&&(*(*(p+i)+j)<=57))))
				{
					m=1;
					break;
				}
			}
		}
		if (m==0)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int main()
{
	char input[82];
	int n  , len ,flag;
	cin>>n;
	cin.get();
	for( int  i = 1 ; i <= n ; i++)
	{
		flag = 1;
		cin.getline( input,82);
	    len = strlen( input); 
		if(((input[0] >= 'a') && (input[0] <= 'z')) || ( (input[0] >= 'A') && (input[0] <= 'Z')) || (input[0] == '_') )
		{
			for( int j = 1 ;j < len ; j++)
			{
			if(((input[j] >= 'a') && (input[j] <= 'z')) || (( input[j] >= 'A') && (input[j] <= 'Z')) || ((input[j] >= '0') && (input[j] <= '9')) || (input[j] == '_'))
			{
				continue;
			}
			else
			{
				flag = 0;
			}
			}
		}
		else
		{
			flag = 0;
		}
		cout<<flag<<endl;
	}
	return 0;
}
int judge(char st[])
{
    int l,t;
    l=strlen(st);t=1;
    if ((st[0]==95)||((st[0]<=90)&&(st[0]>=65))||((st[0]<=122)&&(st[0]>=97))) t=1;
        else {t=0;return t;}
    for (int i=1;i<l;i++)
    {
        if ((st[i]==95)||((st[i]<=90)&&(st[i]>=65))||((st[i]<=122)&&(st[i]>=97))||((st[i]<=57)&&(st[i]>=48))) t=1;
        else {t=0;break;}
    }
    return t;             
}

int main()
{
    int n,i,t;
    char st[100];
    cin>>n;
    gets(st);
    for (i=0;i<n;i++)
    {
        gets(st);
        t=judge(st);
        cout<<t<<endl;
    }
    return 0;
}
int main()
{
char s[1000];
int n,f,k;k=0;
scanf("%d",&n);getchar();
for(k=0;k<n;k++)
{gets(s);
                   f=1;
              if(s[0]=='_'||(s[0]<='Z'&&s[0]>='A')||(s[0]<='z'&&s[0]>='a'))           
                         {for(int i=0;i<strlen(s);i++)
                         {
                         /*if(s[i]=='_'||(s[i]>='A'&&s[i]<='Z')||(s[i]<='z'||s[i]>='a')||(s[i]>='0'&&s[i]<='9'));
                         else
                         {
                          f=0;break;
                          }*/
                          if(s[i]<48||(s[i]>57&&s[i]<65)||(s[i]>90&&s[i]<95)||(s[i]>95&&s[i]<97)||s[i]>122)
                          {
                          f=0;break;
                          }
                          }}
                          else f=0;
                          printf("%d\n",f);
                         }                   
}
void main()
{
	int n,i,j,k;
	char *str[100];
	char **p;
	p=str;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		*(p+i)=(char*)calloc(10000,sizeof(char));
		gets(*(p+i));
	}
	for(k=0;k<n;k++)
	{
		if((**(p+k)<='Z'&&**(p+k)>='A')||(**(p+k)<='z'&&**(p+k)>='a')||**(p+k)=='_')
		{
			for(i=0;*(*(p+k)+i)!='\0';i++)
			{	
				if((*(*(p+k)+i)<='Z'&&*(*(p+k)+i)>='A')||(*(*(p+k)+i)<='z'&&*(*(p+k)+i)>='a')||(*(*(p+k)+i)<='9'&&*(*(p+k)+i)>='0')||*(*(p+k)+i)=='_')
					;
				else
				{	printf("0\n");break;}
				if(*(*(p+k)+i+1)=='\0')   /*????????????????????*/
					printf("1\n");
			}
		}
		else
			printf("0\n");
	}
}
/*
 * 1.cpp
 *
 *  Created on: 2010-11-28
 *      Author: Administrator
 */

int main(){
	int n;
	cin>>n;
	char a[100];
	cin.getline(a,81);
	for(int i=0;i<n;i++){
		char b[100];//?????
		cin.getline(b,81);
		int t=1;
		if(!(b[0]=='_'||(b[0]>='a'&&b[0]<='z')||(b[0]>='A'&&b[0]<='Z')))t=0;//?????
		for(int j=0;j<strlen(b);j++)
			if(!(b[j]=='_'||(b[j]>='a'&&b[j]<='z')||(b[j]>='A'&&b[j]<='Z')||(b[j]>='0'&&b[j]<='9')))t=0;//???????
		cout<<t<<endl;
	}return 0;
}
int main()
{
	int len,n,i,j,count=0;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		char a[100];
		cin.getline(a,100);
		len=strlen(a);
		if((a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')||a[0]=='_')
		{
			count=0;
			for(j=1;j<len;j++)
				if((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||a[j]=='_'||(a[j]>='0'&&a[j]<='9'))
					count++;
			if(count==len-1)
				cout<<"1"<<endl;
			else if(count<len-1)
				cout<<"0"<<endl;
		}
		else
			cout<<"0"<<endl;
		
	}
	return 0;

}
int main()
{
   int n, i, l, j, flag;
   char a[81];
   cin >> n;
   gets(a);
   for(i = 1; i <= n; i++)
   {
       flag = 1;
       gets(a);
       l = strlen(a);
       if(a[0] != '_' &&(a[0] < 'a' || a[0] > 'z') && (a[0] < 'A' || a[0] > 'Z'))
       {    
           flag = 0;
           cout << "0" << endl;
       }
       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'))
		   {    
             if (flag)
                cout << "0" << endl;
			 flag = 0;
			 break;
		   }
       if(flag)
          cout << "1" << endl;
     }
   return 0;
}
int main()
{
	int n, i, j;
	int b, c,flag = 0;
	char a[81];
	cin >> n;
	cin.get();

	for(j = 1; j <= n; j++)
	{
		
		cin.getline(a, 81);
		b = (a[0] <= 'z' && a[0] >= 'a') || (a[0] <= 'Z' && a[0] >= 'A') || (a[0] == '_');
		c = (a[0] <= '9' && a[0] >= '0');
		if(b)
		{
			flag =1;
			for(i = 0; a[i] != '\0'; i++)
			{
				b = (a[i] <= 'z' && a[i] >= 'a') || (a[i] <= 'Z' && a[i] >= 'A') || (a[i] == '_');
				c = (a[i] <= '9' && a[i] >= '0');
				
				if(!(b || c))
				{
					cout << "0" << endl;
					flag = 0;
					break;
				}

			}

			if(flag)
				cout << "1" << endl;
		}
		else 
			cout << "0" << endl;
	}

	return 0;
}
int main()
{
	char *p;
	char string[100];
	p=string;
	int n;
	int i,legal=1;
	int count=0;
	scanf("%d\n",&n);
	while(count<n)
	{
		gets(p);
		i=0;
		if(!( (*p>=65 && *p<=90) || (*p>=97 && *p<=122) || (*p==95) ))
		{
			legal=0;
			printf("0\n");
		}else{
			while(*(p+i)!='\0')
			{
				if(!( (*(p+i)>=65 && *(p+i)<=90) || (*(p+i)>=97 && *(p+i)<=122) || (*(p+i)==95) || (*(p+i)>=48 && *(p+i)<=57) ))
				{
					legal=0;
					printf("0\n");
					break;
				}else{
					i++;
				}
			}
			if(legal==1)
				printf("1\n");
		}
		legal=1;
		count++;
		p=string;
	}
	return 0;
}
//**************************************
//* ????????C????????  *
//* ?????                         *
//**************************************
int main()
{
	int n,i=0,j=0,count=0,first=1;
	char c[100][82]={0};
		cin>>n;
		cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(c[i],82);
	}
		for(i=0;i<n;i++,first=1,count=0,j=0)
		{
		while(c[i][j]!=0)                                           //????'\0'??
		{
			if(first)                                               //?????????
			{
				if((c[i][j]>=65&&c[i][j]<=90)||(c[i][j]>=97&&c[i][j]<=122)||(c[i][j]==95))
				{
					count++;                                        //count?????????????
					first=0;
					j++;                                            //j??????????
				}
				else {
					   j++;
					break;}

			}
			else                                                     //???????????
			{
				if((c[i][j]>=65&&c[i][j]<=90)||(c[i][j]>=97&&c[i][j]<=122)||(c[i][j]==95)||(c[i][j]>=48&&c[i][j]<=57))
				{
					count++;
					j++;
				}
				else
				{
					j++;
					break;
				}
			}
		}
						if(count==j)                                  //??????????????????
							cout<<1<<endl;
						else 
							cout<<0<<endl;
			}
	return 0;
}
int main()
{
   int n;
   cin>>n;
   char s[1001];int i=0;
   while(cin.getline(s,1001))
   {   int ok=0;
      i++;


       if((s[0]>='a')&&(s[0]<='z')) ok=1;
	   else if((s[0]>='A')&&(s[0]<='Z'))ok=1;
	   else if(s[0]=='_')  ok=1;

	   if(ok)//????
		   {
	   for(int j=1;s[j];j++)
	   {
		   if((s[j]>='a')&&(s[j]<='z'))  ok=1;
		   else if((s[j]>='A')&&(s[j]<='Z')) ok=1;
		   else if((s[j]>='0')&&(s[j]<='9'))  ok=1;
		   else if(s[j]=='_')  ok=1;
		   else {
			   ok=0;break;//?????????????

		   }
        }
	   }
	   if(i!=1)
	   cout<<ok<<endl;//????????????????????

   }
  return 0;//?????
}
int check(char a[100])
{int t =strlen(a),i,j=1;
     if((a[0]>='a'&&a[0]<='z')||(a[0]=='_'))
             {if(t==1) return 1;
             for (i=1;i<t;i++)
              if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')||(a[i]>='0'&&a[i]<='9')||(a[i]=='_'))
              j++;
             }
     else if(a[0]>='A'&&a[0]<='Z')
             {if(t==1) return 1;
                                  for (i=1;i<t;i++)
              if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')||(a[i]>='0'&&a[i]<='9')||(a[i]=='_'))
              j++;
             }
     else return 0;
     if(j==i)
     return 1;
     else return 0;
    }
main()
{
      int n,i;
      char a[100];
      scanf("%d",&n);
      gets(a);
      for(i=0;i<n;i++)
      {      gets(a);
             int k=check(a);
             printf("%d\n",k);         
      }
getchar();
getchar();getchar();getchar();getchar();getchar();getchar();

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

	return 0;
}
int main(){
	int n,i,j;
	char a[81];
	cin>>n;
	cin.getline(a,81);
	for(i=0;i<n;i++){
		cin.getline(a,81);
		if(((a[0]!='_')+(a[0]>'Z'||(a[0]<'A'))+(a[0]>'z'||a[0]<'a'))==3)cout<<'0'<<endl;
		else{
			for(j=0;j<strlen(a);j++)
				if(((a[j]!='_')+(a[j]>'9'||a[j]<'0')+(a[j]>'Z'||(a[j]<'A'))+(a[j]>'z'||a[j]<'a'))==4){cout<<'0'<<endl;break;}
			if(j==strlen(a))cout<<'1'<<endl;
		}
	}
	return 0;
}
int main()
{
	int n, istrue, len, i;
	char a[81];
	cin >> n;
	cin.get();
	while(n --)
	{
		cin.getline(a, 81);
		len = strlen(a);
		istrue = 1;
		if ((a[0] != '_') && (a[0] < 'a' || a[0] > 'z') && (a[0] < 'A' || a[0] > 'Z'))
			istrue = 0;
		for (i = 1; i < len; i ++)
			if ((a[i] != '_') && (a[i] < 'a' || a[i] > 'z') && (a[i] < 'A' || a[i] > 'Z') && (a[i] > '9' || a[i] < '0'))
				istrue = 0;
		cout << istrue << endl;
	}
}
int main()
{
    int n,i,t,j,l;
    char a[65535],str[65535];
    gets(str);
    n=atoi(str);
    for(i=0;i<n;i++)
        {
            gets(a);
            l=strlen(a);
            if((a[0]=='_')||(a[0]>='A'&&a[0]<='Z')||(a[0]>='a'&&a[0]<='z'))
                {
                    for(j=1;j<l;)
                        {
                            
                            if((a[j]<='9'&&a[j]>='0')||(a[j]>='A'&&a[j]<='Z')||(a[j]>='a'&&a[j]<='z')||(a[j]=='_'))
                                {j++;}
                            else
                                {
                                    
                                    printf("0\n");
                                    break;
                                }
                        }
                    if(j==l)
                        printf("1\n");
                }
            else
                printf("0\n");
        }
    getchar();
}
int anyil(char*,int);
int first(char);
int main()
{
    int i,j,n;
    cin>>n;
    cin.get();
    for(i=0;i<n;i++)
    {
        char str[1000];
        int i,l,out;
        cin.getline(str,800);
        for(i=0;str[i]!='\0';i++)//????
        l=i+1;
        out=anyil(str,l)&&first(str[0]);//????out?1
        cout<<out<<endl;
    }
    return 0;
}
int anyil(char x[],int l)//??????????????????1
{
    int i,flag=1;
    for(i=0;i<l;i++)
    {
        if (x[i]=='_'||(x[i]>='0'&&x[i]<='9')||(x[i]>='a'&&x[i]<='z')||(x[i]>='A'&&x[i]<='Z'));
        else flag=0;
    }
    return flag;
}
int first(char x)//??????????????????1
{
    int flag;
    if (x=='_'||(x>='a'&&x<='z')||(x>='A'&&x<='Z')) flag=1;
    else flag=0;
    return flag;
}
int main()
{
	int n,i,j,k;
	scanf("%d",&n);
	char s[n][81],c;
	c=getchar();
	int ss[n];
	for(i=0;i<n;i++) ss[i]=1; 
	for(i=0;i<n;i++)
	{
		gets(s[i]);
		int S=strlen(s[i]);
		if(s[i][0]=='_'||(s[i][0]<='Z'&&s[i][0]>='A')||(s[i][0]<='z'&&s[i][0]>='a'))
		{
			for(j=1;j<S;j++)
			{
				if(s[i][j]=='_'||(s[i][j]<='Z'&&s[i][j]>='A')||(s[i][j]<='z'&&s[i][j]>='a')||(s[i][j]<='9'&&s[i][j]>='0')) ss[i]=ss[i]*1;
				else ss[i]=0;
			}
		}
		else ss[i]=0;
		printf("%d\n",ss[i]);
	}
}
int main()
{
	char a[A],c;
    int n,i,l,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("\n");
		j=0;
		gets(a);
		l=strlen(a);
		if(a[0]=='_'||('a'<=a[0]&&a[0]<='z')||('A'<=a[0]&&a[0]<='Z'))
		{
            for(j=1;j<l;j++)
			{
				if(a[j]=='_'||('a'<=a[j]&&a[j]<='z')||('A'<=a[j]&&a[j]<='Z')||('0'<=a[j]&&a[j]<='9')) ;
				else break;
			}
		}
		if(j==l) printf("1\n");
		else  printf("0\n");
    }
	return 0;
}
int main()
{
	char str[81];
	int n=0,i=0,j=0,k=0,flags=0,count=0;
	cin>>n;
	cin.get();
	for(i=1;i<=n;i++)
	{
		flags=1;
		cin.getline(str,81,'\n');
		k=strlen(str);
		for(j=0;j<k;j++)
		{
			if(((int)str[j]>'z'||(int)str[j]<'a')&&((int)str[j]>'9'||(int)str[j]<'0')&&((int)str[j]>'Z'||(int)str[j]<'A')&&str[j]!='_')
			{
				flags=0;
				break;
			}
		}
		if(flags==0)
			cout<<0<<endl;
		else if(str[0]=='0'||str[0]=='1'||str[0]=='2'||str[0]=='3'||str[0]=='4'||str[0]=='5'||str[0]=='6'||str[0]=='7'||str[0]=='8'||str[0]=='9')
			cout<<0<<endl;
		else 
			cout<<1<<endl;
	}
	return 0;
}
int main(){
	int n,i,j;
	cin>>n;
	int b[n];
	char a[n][100];
	for(i=0;i<=n;i++){
		cin.getline(a[i],100);
	    b[i]=strlen(a[i]);}

	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')))==1){
			for(j=0;j<strlen(a[i]);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'))==0){cout<<"0"<<endl;break;}
			if((j==strlen(a[i]))==1)
			cout<<"1"<<endl;
		}
				else
			cout<<"0"<<endl;
	return 0;//??
}
int main()
{
   int n;char q[10];
   scanf("%d",&n);
   gets(q);
   for(int j=0;j<n;j++)
   {
            char s[80];
            
            int num=0;
            int a=0;
            gets(s);
            
            int len=strlen(s);
            for(int i=0;i<len;i++)
                   if((s[i]<'0')||((s[i]>'9')&&(s[i]<'A'))||((s[i] >'Z')&&(s[i]<'a'))||(s[i]>'z'))
                   {
                              if(s[i]!='_')
                              {printf("0\n");a=1;break;}
                   }
                   if(a==0)
                   {
                          for(int i=0;i<26;i++)
                          {
                                  if((s[0]=='a'+i)||(s[0]=='A'+i))
                                   {
                                                  
                                                  printf("1\n");
                                                  num=1;
                                   }
                          }
                          if(s[0]=='_')
                          {
                                     printf("1\n");
                                     num=1;
                          }
                   }
                
                    
            
                  if(num==0&&a!=1) printf("0\n");
   }
   getchar();
   getchar();
   getchar();
                
}
//*************************************
//*?????????C????????*
//*???1000012797                   *
//*????:??????????      *
//*************************************
int main()                //???
{
	char a[500]={'\0'};
	int n=0,i=0,j=0,m=0,count=0;           //??
	cin>>n;
	cin.getline(a,500);
	for(j=0;j<n;j++)
	{
		count=0;
		cin.getline(a,500);
		m=strlen(a);
		if(a[0]==95||(a[0]>=97&&a[0]<=123)||(a[0]>=65&&a[0]<=91))
				count+=1;
		for(i=0;i<m;i++)
		{
			if(a[i]==95||(a[i]>=97&&a[i]<=123)||(a[i]>=65&&a[i]<=91)||(a[i]>=48&&a[i]<=57))
				count+=1;
		}
		if(count==m+1)
			cout<<"1"<<endl;
		else
			cout<<"0"<<endl;
	}
	
	return 0;
}
int main()
{
    char a[81];
    int n,i,j;
    scanf("%d",&n);
    gets(a);

    for(i=0;i<=n-2;i++)
    {
        gets(a);
        if(a[0]<='Z'&&a[0]>='A')
        {
            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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }
            if(a[j]=='\0')
            {
                printf("1\n");
            }
       }
       else if(a[0]<='z'&&a[0]>='a')
       {
           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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }
           if(a[j]=='\0')
           {
               printf("1\n");
           }
       }
       else if(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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }
           if(a[j]=='\0')
           {
               printf("1\n");
           }
       }
       else
       {
           printf("0\n");
       }
    }
    gets(a);
    if(a[0]>='A'&&a[0]<='Z')
    {
        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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }

        if(a[j]=='\0')
        {
            printf("1");
        }
    }
    else if(a[0]<='z'&&a[0]>='a')
    {
        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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }
        if(a[j]=='\0')
        {
            printf("1");
        }
    }
    else if(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]=='_')
                {
                    continue;
                }
                else
                {
                    printf("0\n");
                    break;
                }
            }
        if(a[j]=='\0')
        {
            printf("1");
        }
    }
    else
    {
           printf("0");
    }
}
int main()
{
  int n,j;
  scanf("%d\n",&n);
  char string[100][81];
  for(int i=0;i<n;i++)
  gets(string[i]);//scanf("%s",string[i]);
  for(int i=0;i<n;i++)
  {
     int l=strlen(string[i]);
     j=0;
     if((string[i][0]>='A'&&string[i][0]<='Z')||(string[i][0]>='a'&&string[i][0]<='z')||string[i][0]=='_')
          {
          for(j=0;j<l;j++)
          if(string[i][j]>='A'&&string[i][j]<='Z'||string[i][j]>='a'&&string[i][j]<='z'||string[i][j]=='_'||string[i][j]>='0'&&string[i][j]<='9')
          continue;
           else
          break;
          }
          if(j>=l)
          printf("1\n");
          else 
          printf("0\n"); 
           
  }  
}
void main()
{
	int n,i,j,k,flag;
	char *s;
	s=malloc(100*sizeof(char));
	scanf("%d",&n);
	gets(s);
	for(i=1;i<=n;i++)
	{flag=1;k=0;
	gets(s);
	if(*(s+0)=='_') k=1;if(*(s+0)<='9'&&*(s+0)>='0') flag=0;
	for(j=k;*(s+j)!='\0';j++)
		if(*(s+j)<='z'&&*(s+j)>='A')  ;
		    else if(*(s+j)<='9'&&*(s+j)>='0') ;
			else flag=0;
	printf("%d\n",flag);
	}
}
void main()
{
  int i,n,t,m,j;
  char a[85];
  scanf("%d",&n);
  getchar();
  for(i=1;i<=n;i++)
  {
	gets(a);
	m=strlen(a);
	if((a[0]=='_')||((a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')))  t=1;
	else t=0;
	if(t)
	{
	  for(j=1;j<m;j++)
	  {
	    if((a[j]=='_')||((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z'))||(a[j]>='0'&&a[j]<='9'))  t=1;
		else 
		{
		  t=0;
		  break;
		}
	  }
	}
	if(t)  printf("1\n");
	else printf("0\n");    
  }
}
int main()
{
	int i,j,l,counter;
	char c[2];
	gets(c);
	int n=atoi(c);
	char a[100];
	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,counter=0;j<l;j++)
				if(!((a[j]>='A'&&a[j]<='Z')||(a[j]>='0'&&a[j]<='9')||(a[j]>='a'&&a[j]<='z')||a[j]=='_'))
				{
					printf("0\n");
					counter++;
					break;
				}
			if(counter==0)
				printf("1\n");
		}
	}
	return 0;
}
int main()
{
	char str[81];
	int i, n, flag, j;
	cin >> n;
	cin.get();
	for(i = 1; i <= n; i++)
	{
		flag = 0;
		cin.getline(str,81);
		if( (str[0] >= 'a' && str[0] <= 'z') || ( str[0] >= 'A' && str[0] <= 'Z') || str[0] == '_')
			flag = 1;
		for(j = 1; str[j] != '\0'; j++)
			if(  !  (   (str[j] >= 'a' && str[j] <= 'z')   || ( str[j] >= 'A' && str[j] <= 'Z') || str[j] == '_' || (str[j] >= '0' && str[j] <= '9')  )  )
				flag = 0;
		cout << flag << endl;
	}
	return 0;
}
/**
* @file 1000010424_4.cpp
* @author ???
* @date 2010?11?20
* @description
* ??????: ?????C????????
*/



int main()
{
	int n, i, j;										//?????????????
	char input[90];										//????????
	int sum, len;										//??????????????

	cin >> n;
	cin.ignore();

	for(i = 1; i <= n; i++)
	{
		cin.get(input, 90);							//??90??????????~?
		getchar();
		len = strlen(input);							//?????
		sum = 0;

		if(input[0] == '_' || (input[0] <= 'z' && input[0] >= 'a') || (input[0] <= 'Z' && input[0] >= 'A'))
		{
			sum++;

			for(j = 1; j < len; j++)
				if(input[j] == '_' || (input[j] <= 'z' && input[j] >= 'a') || (input[j] <= 'Z' && input[j] >= 'A')
					 || (input[j] >= '0' && input[j] <= '9'))
					 sum++;
				else
					break;
		}

		if(sum == len)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}

	return 0;
}
int main()
{
char st[1000][81]={{'\0'}};
int n,i=0,j,k=0,t,q=0;
cin>>n;
cin.get();
for(i = 0; i < n; i++)
{
cin.getline(st[i],81);
if((st[i][0]<'A'||(st[i][0]>'Z'&&st[i][0]<'a')||st[i][0]>'z')&&st[i][0]!='_')
{
cout<<"0"<<endl;
continue;
}
for(j=1;st[i][j]!='\0';j++)
{
if(st[i][j]<'A'||(st[i][j]>'Z'&&st[i][j]<'a')||st[i][j]>'z')
{
if(st[i][j]=='_'||(st[i][j]>='0'&&st[i][j]<='9'))
continue;
else
    k++;
}
}
if(k==0)
cout<<"1"<<endl;
else
cout<<"0"<<endl;
k=0;
}
return 0;
}
main()
{
      int n;
      char z[1];
      gets(z);
      n=atoi(z);   
      int i,j;
      char a[2][100000];
      for(i=0;i<n;i++)
      {
             gets(a[0]);
             int t;
             t=strlen(a[0]);
             if(a[0][0]-'_'==0 || (a[0][0]>='a' && a[0][0]<='z') || (a[0][0]>='A' && a[0][0]<='Z'))
             {
                       for(j=1;j<t;j++)
                       {
                             if(!( (a[0][j]>='a' && a[0][j]<='z') || (a[0][j]-'_'==0) || (a[0][j]>='0' && a[0][j]<='9') || (a[0][j]>='A' && a[0][j]<='Z') ))
                             break;
                        }
              if(j==t) printf("1\n");
              else printf("0\n");
              }
         else printf("0\n");
      }
      getchar();getchar();getchar();getchar();
      }
int main()
{
    int i,j,n;
    char m[3],s[100][81];   
    gets(m);
    n=atoi(m);
    
    for(i=0;i<n;i++){
        gets(s[i]);
        int num=0;
        if(s[i][0]=='_'||(64<s[i][0]&&s[i][0]<91)||(96<s[i][0]&&s[i][0]<123)){
            for(j=0;j<strlen(s[i]);j++)
                if((47<s[i][j]&&s[i][j]<58)||(64<s[i][j]&&s[i][j]<91)||(96<s[i][j]&&s[i][j]<123)||s[i][j]=='_')   
                    num++;
            if(num==strlen(s[i]))
                printf("1\n");
            else
                printf("0\n");
        }
        else
            printf("0\n");    
    } 
}
int main()
{
	int num,i;
	scanf("%d",&num);
	char **p; 
	int judge(char *x);
	p=(char **)malloc(num*sizeof (char *));
	for(i=0;i<num+1;i++)
	{
		*(p+i)=(char *)malloc(100);
		gets(*(p+i));
	}
	for(i=1;i<num+1;i++)
		printf("%d\n",judge(*(p+i)));
}
int judge(char *x)
{
	int i,flag=0;
	if(*x=='_'||*x>='a'&&*x<='z'||*x>='A'&&*x<='Z')
		flag=1;
	for(i=1;*(x+i)&&flag==1;i++)
		if((*(x+i)>='a'&&*(x+i)<='z'||*(x+i)>='A'&&*(x+i)<='Z'||*(x+i)>='0'&&*(x+i)<='9'||*(x+i)=='_')!=1)
			flag=0;
	return flag;
}