semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,m,i,j,pd;
	char bsf[81],*p;
	p=bsf;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		pd=1;
		gets(bsf);
		m=strlen(bsf);
		if(*p>=48&&*p<=57)
			pd=0;
		else{
			for(j=0;j<m;j++){
				if(!(*(p+j)==95||(*(p+j)>96&&*(p+j)<123)||(*(p+j)>47&&*(p+j)<58)||(*(p+j)>64&&*(p+j)<91)))
					pd=0;
			}
		}
		printf("%d\n",pd);
	}
	return 0;
}
int legal(char *p){//??????????
	int i;
	for(i=0;*(p+i)!=0;i++){
		if(i==0){
			if(*(p+i)!='_'&&!(*(p+i)>='a'&&*(p+i)<='z')&&!(*(p+i)>='A'&&*(p+i)<='Z'))break;
		}
		else if(*(p+i)!='_'&&!(*(p+i)>='a'&&*(p+i)<='z')&&!(*(p+i)>='A'&&*(p+i)<='Z')
				&&!(*(p+i)>='0'&&*(p+i)<='9'))break;
	}
	if(*(p+i)==0)return 1;
	return 0;
}
int main(){
	int n;
	char string[81];
	cin>>n;
	cin.getline(string,80);
	for(;n>0;n--){
		cin.getline(string,81);
		cout<<legal(string)<<endl;
	}
	return 0;
}
int main()
{
    int ff(char str[]);
    int t,i,p;
    char str[1000];
    cin>>t;
    getchar();
    for(i=1;i<=t;i++)
   {
    cin.getline(str,800,'\n');
    p=ff(str);
    cout<<p<<endl;
    str[0]=0;
   }
return 0;
}


   int ff(char str[])
{
      int j,n=0,x=1;
      
      if((str[0]>=65&&str[0]<=90)|| (str[0]>=97&&str[0]<=122)||(str[0]=='_'))
         {
           for(j=1;j<=strlen(str)-1;j++)
           {
               if((str[j]>=65&&str[j]<=90)|| (str[j]>=97&&str[j]<=122)||(str[j]=='_')||(str[j]>=48&&str[j]<=57))
                  {n=1; continue;}
               else {x=0; n=0;break;}
           } 
           {
            if(n)
                {x=1;n=0;}    
            else x=x;
            }
         }
      else x=0;
    return (x);
}
//********************
int n=0,i=1,leg=1,len=0,flag=0;
char a[81]={0};
int b[81]={0};
//********************
int main()
{
    cin>>n;
    cin.get();
    while(i<=n)
    {
               cin.getline(a,81);
               
                   for(int m=0;a[m]!='\0';m++)
                    {
                       len++;
                       b[m]=a[m];
                    }
                    
                    
               
                    leg=1;
                    if(b[0]>=65&&b[0]<=90
                      ||b[0]>=97 && b[0]<=122
                      ||b[0]==95)
                    {
                        
                        for(int j=1;j<len;j++)
                        {
                        if(b[j]>=65 && b[j]<=90
                         ||b[j]>=97 && b[j]<=122
                         ||b[j]==95
                         ||b[j]>=48 && b[j]<=57)
                          {
                              flag=1;
                          }
                         else
                              flag=0;
                              
                         leg=leg*flag;
                         }
                    }
                    else 
                     leg=0;
   
               cout<<leg<<endl;
               for(int m1=0;m1<81;m1++)
               {
                  a[81]=0;
                  b[81]=0;}
               
                i++;
                len=0;
                leg=1;
                }
    
       return 0;
              
               
}
int f(char c)
{
 if(c>='a'&&c<='z') return 1;
 if(c>='A'&&c<='Z') return 1;
 if(c=='_') return 1;
 else return 0;
}
main()
{
 int a,n;
 int i;
 scanf("%d",&n);
 char str1[2];
 gets(str1);
 while(n--)
 {
  char str[100]={""};
  gets(str);
  int len=strlen(str);
  if(f(str[0])==1)
  {
   for(i=1;str[i]!='\0';i++)
   if((str[i]>='0'&&str[i]<='9')||f(str[i])==1) continue;
   else break;
   if(i==len) printf("%d\n",1);
   else printf("%d\n",0);
  }
  else
  printf("%d\n",0);
 }
}
int main()
{
	char str[100][81];
	int i,j,flag[100],n;
	cin >> n;
	cin.get();
	for (i =0;i < n;i ++)
		cin.getline(str[i],81);
	for (i = 0;i < n;i ++)
		for (j = 0;str[i][j] != '\0';j ++)
		{
			// ?????
			if (j == 0)
			{
			    if (str[i][0] == '_' || str[i][0] >= 'a' && str[i][0] <= 'z' || str[i][0] >='A' && str[i][0] <= 'Z')
				    flag[i] = 1;
			    else
				    flag[i] = 0;
			}
			// ??????_ AZ az 09
			if (flag[i] == 1)
			{
				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[i] = 1;
				else
					flag[i] = 0;
			}
		}
	for (i = 0;i < n;i ++)
		cout << flag[i] << endl;
	return 0;
}
int zimuxiahuaxian(char x)
{
	int a;
	if((x>=65&&x<=90)||(x>=97&&x<=122)||x=='_') a=1;
	else a=0;
	return a;
}

int shuzi(char x)
{
	int a;
	if((x>=48)&&(x<=57)) a=1;
	else a=0;
	return a;
}
int main()
{
	int n,i,m,j,k=0;
	char a[81];
	scanf("%d",&n);
	gets(a);
	for(i=0;i<n;i++)
	{
		gets(a);
        m=strlen(a);
		if(zimuxiahuaxian(a[0])==0) k=0;
		else
		{
			k=1;
			for(j=1;j<m;j++)
			{
                if(zimuxiahuaxian(a[j])!=1&&shuzi(a[j])!=1)
				{
					k=0;
					break;
				}
				else k=1;
			}
		}
		if(k==0) printf("0\n");
		else printf("1\n");
	}
	return 0;
}
int main()
{
	int i, k, n;
	char a[81];
	cin >> n;
	cin.get();
	for (k = 1; k <= n; k++)
	{
		memset(a, 0, sizeof(a));
		cin.getline(a, sizeof(a));
		if((a[0] == '_') || (a[0] >= 'a' && a[0] <= 'z') || (a[0] >= 'A' && a[0] <= 'Z'))
		{
			for (i = 1; a[i] != '\0';)
			{
				if ((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z') || (a[i] >= '0' && a[i] <= '9') || a[i] == '_')
					i++;
				else
					break;
			}
				if (a[i] == '\0')
					cout << '1' << endl;
				else
					cout << '0' << endl;
		}
		else
			cout << '0' << endl;
	}
	return 0;
}
void main()
{
	char s[100][81];
	int n,i,a[81],j,k,r;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	    gets(s[i]);
	for(j=0;j<n;j++)
	{
		for(k=0;k<strlen(s[j]);k++)
			a[k]=(int)s[j][k];
		if(a[0]==95||(a[0]>96&&a[0]<123)||(a[0]>64&&a[0]<91))
		{
			for(r=0;r<strlen(s[j]);r++)
			{
				if((a[r]>96&&a[r]<123)||(a[r]>64&&a[r]<91)||(a[r]==95)||(a[r]>47&&a[r]<58))
				{
					if(r==strlen(s[j])-1)
						printf("1\n");
					else
					    continue;
				}
				else
				{
					printf("0\n");
					break;
				}
			}
		}
		else
			printf("0\n");
	}
}
main(){
int n;
scanf("%d",&n);
getchar();
for (int i=1;i<=n;i++)
{
char s[100];
gets(s);
int len=strlen(s);
int flag=(s[0]=='_'||(s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z'));
for (int j=1;j<len;j++)
{
flag&=(s[j]=='_'||(s[j]>='a'&&s[j]<='z')||(s[j]>='A'&&s[j]<='Z')||(s[j]>='0'&&s[j]<='9'));
}
printf("%d\n",flag);
}
getchar();getchar();getchar();
}
void main()

{int n,i,j,k;
char *p[100],s[100][82];
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{
gets(s[i]);

k=0;
p[i]=s[i];
{if(((int)*p[i]>64&&(int)*p[i]<91)||((int)*p[i]>96&&(int)*p[i]<123)||*p[i]=='_')
k=k+0;
else
k=k+1;
}
p[i]++;

for(;*p[i]!='\0';p[i]++)
{

if(((int)*p[i]>64&&(int)*p[i]<91)||((int)*p[i]>96&&(int)*p[i]<123)||*p[i]=='_'||((int)*p[i]>47&&(int)*p[i]<58))
k=k+0;
else
k=k+1;}

if(k==0)
printf("1\n");
else if(k>0)
printf("0\n");

}
}
int main()
{
    int n,i,j,l;
    int x=0,y=1;
    char a[100];
    char str[100];
    gets (str);
    n=atoi(str);
    for (i=0;i<n;i++)
    {
        gets (a);
        l=strlen (a);
        if (a[0]=='_' ||(a[0]<123 && a[0]>96) || (a[0]>64 && a[0]<91) ) 
        {
           for (j=0;j<l; )
           {
               if (a[j]=='_' ||(a[j]<123 && a[j]>96) || (a[j]>64 && a[j]<91) || (a[j]>47 &&a[j]<58))  
               j++;
               else 
               break;
           } 
           if (j==l)
           printf ("%d\n",y);
           else
           printf ("%d\n",x);       
        }
        else
        printf ("%d\n",x);
    }
    getchar ();
    getchar ();
}
int main()
{
    int n,i,j,k;
    char a[100],b[12];
    scanf("%d",&n);
    gets(b);
    for(i=0;i<n;i++)
      {
       int l;             
      gets(a);
      l=strlen(a);
      for(j=0;j<l;j++)
         {if((a[j]>='A'&&a[j]<='z')||(a[j]<='9'&&a[j]>='0')||a[j]=='_')
           continue;
          else
          break;} 
      if(j==l)     
       {
           if((a[0]<='z'&&a[0]>='A')||a[0]=='_')
          printf("1\n");
      else
           printf("0\n");
           }
      else
         printf("0\n");
     }
     getchar();
     getchar();
     getchar();
}
void main()
{
	char a[100][100000];
	int n;
	int b[100];
	int *q;
	char (*p)[100000];
    scanf("%d\n",&n);
	for(p=a;p<a+n;p++)
	{
		gets(*p);
	}
	q=b;
	for(p=a;p<a+n;p++)
	{
		char *s;
		s=*p;
		if((*s>=65&&*s<=90)||(*s>=97&&*s<=122)||(*s=='_'))
		{
			int w=0;
			for(s=*p+1;*s!=0;s++)
			{
				if((*s>=65&&*s<=90)||(*s>=97&&*s<=122)||(*s=='_')||(*s>=48&&*s<=57))
				{
					w=0;
				}
				else
				{
					w=1;
					break;
				}
			}
			if(w==0)
			{
				*q=1;
			}
			else
			{
				*q=0;
			}
		}
		else
		*q=0;
		q++;
	}
	for(q=b;q<b+n;q++)
	{
		printf("%d\n",*q);
	}
}
int legal(char zfc[81]);

int main(int argc, char* argv[])
{
	int n,i,judge;
	char str[81];
         gets(str);
         n = atoi(str);
	for(i=0;i<n;i++)
	{
		gets(str);
		judge=legal(str);
		printf("%d\n",judge);
	}
	
	return 0;
}


int legal(char zfc[81])
{
	int lenth,i,m=1;
	lenth=strlen(zfc);

	if(zfc[0]=='_'||(zfc[0]>='A'&&zfc[0]<='Z')||(zfc[0]>='a'&&zfc[0]<='z'))
	{
		for(i=1;i<lenth;i++)
		{
			if((zfc[i]>='A'&&zfc[i]<='Z')||(zfc[i]>='a'&&zfc[i]<='z')||(zfc[i]>='0'&&zfc[i]<='9')||zfc[i]=='_')
				m=1;
			else
			{
				m=0;break;
			}
		}
		if(m)
			return 1;
		else
			return 0;
	}
	else
		return 0;			
}
int main()                                                                    //???
{
	int n=0,x=0,flag=0,i=0,j=0,k=0;                                       //?????flag?????
	char str[81]={0};                                                     //??????????????
	cin>>n;
	cin.get();                                                            //????
	for(i=1;i<=n;i++)                                                     //?????
	{
		for(j=1;j<=81;j++)                                            //????????
		{
			str[j-1]=0;
		}
		flag=0;                                                       //??????flag=0
		gets(str);
		x=strlen(str);                                                //????????
		if(str[0]<'A'||(str[0]>'Z'&&str[0]<'_')||(str[0]>'_'&&str[0]<'a')||str[0]>'z')               //???????
		{
			cout<<"0"<<endl;
			continue;
		}
		for(k=2;k<=x;k++)                                             //????????????????
		{
			if(str[k-1]<'0'||(str[k-1]>'9'&&str[k-1]<'A')||(str[k-1]>'Z'&&str[k-1]<'_')||(str[k-1]>'_'&&str[k-1]<'a')||str[k-1]>'z')
			{
				flag=1;
				break;
			}
		}
	        if(flag==0)                                                   //??flag??????????
		{
			cout<<"1"<<endl;
		}
		else
		{
			cout<<"0"<<endl;
		}
	}
	return 0;
}
int f( char c);
int main()
{
	int n,i,j,out;
    char s[100],r;
	scanf("%d%c",&n,&r);
	while(n--)
	{
        gets(s);
		if( !f(s[0]) ) out=0;
		else
		{
			for(i=1;s[i]!='\0';i++)
			{
				if(  !( f(s[i]) || (s[i]>='0'&&s[i]<='9') ) )
				{
					out=0;break;
				}
			}
			if(s[i]=='\0') out=1;
		}
		printf("%d\n",out);
	}
	return 0;
}
int f(char c)
{
	if( (c=='_') || (c>='A'&&c<='Z') || (c>='a'&&c<='z') ) return 1;
	else return 0;
}
int main ()
{
	int n,i,j;
	char str[81];
	cin >> n;
	cin.get();
	for (i =1;i<= n;i++)
	{
		cin.getline(str,81);
		if ((((str[0] >='A')&&(str[0] <='Z'))||((str[0] >='a')&&(str[0] <='z'))||(str[0] =='_'))==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] <='9')&&(str[j]>='0')))==0)
				{
					cout << "0" <<endl;
					break;
				}
			}
			if (str[j] == '\0')
				cout << "1" << endl;
		}
		else
		cout << "0" << endl;
	}
	return 0;
}
//?????C????????
int main()
{
	char a[101][100];
	int l[101];
	int n;//n????
	cin>>n;
	cin.getline(a[0],100);
	for(int i=1;i<=n;i++)
		{
		cin.getline(a[i],100);
		l[i]=strlen(a[i]);
		}
	for(int 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')))
			for(int j=0;j<l[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')))
					{
					if(j==l[i]-1)
						cout<<1<<endl;
					continue;
					}
				else {
					cout<<0<<endl;
					break;
				}

			}
		else cout<<0<<endl;
	}

	return 0;
}
/*
 * ????1000012737_32(5).cpp
 * ??????
 * ????: 2010-11-24
 * ?????????????????????????,?????????????80?????
 * ???????????????????????1????????0????
 */

int main(){
	int n;//????
	cin>>n;//?????????n
	char s[81];//?????
	cin.getline(s,81);
	while(n>0){
		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++;
			}
			if(m==l-1)cout<<'1'<<endl;//?????????????????1???
			else cout<<'0'<<endl;//??????????0???
		}
		else cout<<'0'<<endl;//????????????????????????????????0???
		n--;//n???????
	}
	return 0;//????
}
int main()
{
	char a[100][80],c[100];
	int n,l,i,j,flag=0;
    scanf("%d",&n);
	gets(c);
	for(i=0;i<n;i++)
	{
		gets(a[i]);
		l=strlen(a[i]);
        for(j=0;j<l;j++)
		{
			if(((a[i][0]>='A'&&a[i][0]<='Z')||(a[i][0]>='a'&&a[i][0]<='z')||a[i][0]=='_')&&((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')))
                flag=flag;
			else
				flag++;
		}
		if(flag==0)
			printf("1\n");
		else
			printf("0\n");
		flag=0;
	}
	return 0;
}
main()
{
int n;
int f;

scanf("%d",&n);
getchar();
char p[n][100];
for(int i=0;i<=n-1;i++)
{
  gets(p[i]);

  f=0;
  int l=strlen(p[i]);
  for(int u=0;u<=l-1;u++)
  {
          if(p[i][u]<=47||(p[i][u]>=58&&p[i][u]<=64)||(p[i][u]>=91&&p[i][u]<=94)||(p[i][u]>=123)||p[i][u]==96)
          f=1;
  }
  if(((p[i][0]=='_')||(p[i][0]>='a'&&p[i][0]<='z')||(p[i][0]>='A'&&p[i][0]<='Z'))&&f==0)
  printf("1\n");
  else
  printf("0\n");


}
}
void main()
{
	int n;
	scanf("%d\n",&n);
	int i;
	for(i=1;i<=n;i++)
	{
		char *pnew;
		pnew=(char *)malloc(100*sizeof(char));
		gets(pnew);
		int L=strlen(pnew);
		int judge=0;
		int j;

        if(*pnew=='_')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else if(*pnew<='z'&&*pnew>='a')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else if(*pnew<='Z'&&*pnew>='A')
		{
			judge=1;
		for(j=1;j<L;j++)
		{
		if(*(pnew+j)=='_')
			judge=1;
		else if(*(pnew+j)<='z'&&*(pnew+j)>='a')
			judge=1;
		else if(*(pnew+j)<='Z'&&*(pnew+j)>='A')
			judge=1;
		else if(*(pnew+j)<='9'&&*(pnew+j)>='0')
			judge=1;
		else
		{
			judge=0;
			break;
		}
		}
		}

		else
			judge=0;
		printf("%d\n",judge);
	}
}
int main()
{
char (*pi)[81];
int i,m,n,j,ok=0;
scanf("%d",&n);
pi=(char(*)[81])calloc(n,sizeof(char)*81);
gets(*pi);
for (i=0;i<n;i++)
{
    gets(*(pi+i));
	ok=1;
	m=strlen(*(pi+i));
	if ((*(*(pi+i))>='A'&&*(*(pi+i))<='Z')||(*(*(pi+i))>='a'&&*(*(pi+i))<='z')||(*(*(pi+i))=='_'))
		for (j=1;j<m;j++)
			if ((*(*(pi+i)+j)>='A'&&*(*(pi+i)+j)<='Z')||(*(*(pi+i)+j)>='a'&&*(*(pi+i)+j)<='z')||(*(*(pi+i)+j)=='_')||(*(*(pi+i)+j)>='0'&&*(*(pi+i)+j)<='9'))
				;
			else
				ok=0;
	else
		ok=0;
    printf("%d\n",ok);
}
free(pi);
return 0;
}
int main()
{
	int n,i,j,l,judge;
	char str[81];
	gets(str);
	n=atoi(str);
	for(j=1;j<=n;j++){
		gets(str);
		l=strlen(str);
		judge=1;
		for(i=0;i<l;i++){
			if(i==0){
				if(*(str)!='_'&&(*(str)>'Z'||*(str)<'A')&&(*(str)>'z'||*(str)<'a')){
					judge=0;
					break;
				}
			}
			else{
				if(*(str+i)!='_'&&(*(str+i)>'Z'||*(str+i)<'A')&&(*(str+i)>'z'||*(str+i)<'a')&&(*(str+i)>'9'||*(str+i)<'0')){
					judge=0;
					break;
				}
			}
		}
		printf("%d\n",judge);
	}
	return 0;
}
int main()
{
    int n,i,f,q,d=0;
    scanf("%d",&n);
    char a[30]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_'},c[1000][1000];
    gets(c[1]);
    for(i=1;i<=n;i++)
    {
                      gets(c[i]);
                      d=0;
                      for(q=0;;q++)
                      {
                                   if(c[i][q]==' '||c[i][q]=='.'||c[i][q]=='@'||c[i][q]==';'||c[i][q]=='-'||c[i][q]=='='||c[i][q]=='+')
                                   {
                                   d=5;
                                   }
                                   if(c[i][q]=='\0')
                                   break;
                      }
                      if(d==5)
                      {
                              printf("0\n");
                              continue;
                      }
                      for(f=0;f<=26;f++)
                      {
                                        if(c[i][0]==a[f]||c[i][0]==(a[f]-32))
                                        {
                                        printf("1\n");
                                        d++;
                                        }
                      }
                      if(d==0)
                      {                          
                      printf("0\n");
                      }
    }
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
}
int main()
{
	int i,n;
	char a[81];
	gets(a);
	n=atoi(a);
	for(i=1;i<=n;i++){
		int j=0;
		gets(a);
		char *p=a;
		char *q;
		q=p;
		for(p=q;*p!='\0';p++){
			if(p==q){	
				if(*p=='_'||((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z'))){
					j=1;
				}else{
					j=0;
					break;
				}
			}else{
				if(*p=='_'||((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z'))||(*p>='0'&&*p<='9')){
					j=1;
				}else{
					j=0;
					break;
				}
			}
		}
		printf("%d\n",j);
	}
	return 0;
}
int main()
{int n,i,j,b[100][81]={0},c[100]={0},l;
char a[100][81];
cin>>n;
cin.get();
for(i=0;i<n;i++)
 {cin.getline(a[i],81);
  c[i]=strlen(a[i]);
  for(j=0;j<c[i];j++)
  b[i][j]=a[i][j];
  
  l=1;
  if((b[i][0]>=65&&b[i][0]<=90)||(b[i][0]>=97&&b[i][0]<=122)||b[i][0]==95)
  {
   for(j=1;j<c[i];j++)
   {if((b[i][j]>=65&&b[i][j]<=90)||(b[i][j]>=97&&b[i][j]<=122)||(b[i][j]>=48&&b[i][j]<=57)||b[i][j]==95)
     l++;}
    if(l==c[i])
    cout<<"1"<<endl;
    else cout<<"0"<<endl;}
  else cout<<"0"<<endl;}
 return 0;
}
int main(void)
{
	char string[200][100];
	int n;
	cin>>n;
	getchar();
	int i;
	for(i=0;i<n;i++)
	{
		cin.getline(string[i],100);
	}
	for(i=0;i<n;i++)
	{
		int k=1;
		for(int j=0;j<strlen(string[i]);j++)
		{
			if(j==0)
			{
				if((string[i][j]=='_')||(string[i][j]>='A'&&string[i][j]<='Z')||(string[i][j]>='a'&&string[i][j]<='z'));
				else
					k=0;
			}
			else
			{
				if(string[i][j]=='_'||(string[i][j]>='A'&&string[i][j]<='Z')||(string[i][j]>='a'&&string[i][j]<='z')||(string[i][j]>='0'&&string[i][j]<='9'));
				else
					k=0;
			}
		}
		if(k==0)
			cout<<0<<endl;
		else
			cout<<1<<endl;
	}
	int a;
	cin>>a;
	return 0;
}
main()
{
    int n;
    int i;
    scanf("%d\n",&n);
    char s[100];
    for(i=0;i<n;i++){
    gets(s);
    int m,j=0,count=0;
    while(s[j]!='\0')
    {
        if(s[j]==' '||s[j]<'A'&&s[j]>'9'||s[j]>'Z'&&s[j]<'A'||s[j]>'z'||s[j]<'0')
        count++;
        j++;
    }
    if(s[0]=='_'||s[0]>='a'&&s[0]<='z'||s[0]>='A'&&s[0]<='Z')
    {
        if(count==0)
        {
         m=1;
         }
        else
        m=0;
    }
     else
    m=0;
    printf("%d\n",m);
}
}
int main()
{
	int n;
	int i,j,l;char a[500][1000];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		gets(a[i]);
		l=strlen(a[i]);
		if(a[i][0]=='_'||(a[i][0]<='z'&&a[i][0]>='a')||(a[i][0]<='Z'&&a[i][0]>='A'))
		{
			for(j=0;j<l;j++)
			{
				if((a[i][j]<='z'&&a[i][j]>='a')||(a[i][j]<='Z'&&a[i][j]>='A')||(a[i][j]<='9'&&a[i][j]>='0')||a[i][j]=='_') 
					continue;
				else 
				{ 
					printf("0\n");
					break;}
			}
			if(j==l) printf("1\n");
		}
		else
			printf("0\n");
	}
	return 0;
}
int main()
{
	char a[81];
	int n,i,len,judge;
	cin >> n;
	cin.get();
	while(n--)
	{
		cin.getline(a,81);
		len=strlen(a);
		if(a[0]=='_'||(a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z'))
		{
			judge=1;
			for(i=1;i<=len-1;i++)
			{
				if(a[i]=='_'||(a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')||(a[i]<='9'&&a[i]>='0'))
					judge=1;
				else
				{
					judge=0;
					break;
				}
			}
		}
		else
			judge=0;	
		cout<<judge<<endl;
	}
	return 0;
}
int check(char []);
int main()
{
	int n,i;
	char s[100];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		gets(s);
		printf("%d\n",check(s));
	}
	return 0;
}
int check(char s[])
{
	int i,count=0;
	if(s[0]=='_'||(s[0]<='z'&&s[0]>='a')||(s[0]<='Z'&&s[0]>='A'))
		count++;
	else return 0;
	for(i=1;s[i]!='\0';i++)
	{
		if((s[i]<='9'&&s[i]>='0')||(s[i]<='z'&&s[i]>='a')||(s[i]<='Z'&&s[i]>='A')||(s[i]=='_'))
			count++;
		else 
		{
			count=0;
			break;
		}
	}
	if(count) return 1;
	else return 0;
}
int indent(char zfc[81]);
int main(int argc, char* argv[])
{   int n,s,i;
    char zfc[81];
    scanf("%d\n",&n);
	for(i=0;i<n;i++){
	gets(zfc);
    s=indent(zfc);
	printf("%d\n",s);
	}
	return 0;
}
int indent(char zfc[81]){
	int i,s=0,sum=0;
	char *p=zfc;
	if((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')||(*p=='_')){
		for(i=1;i<strlen(zfc);i++){
			if((*(p+i)>='a'&&*(p+i)<='z')||(*(p+i)>='A'&&*(p+i)<='Z')||(*(p+i)=='_')||(*(p+i)>='0'&&*(p+i)<='9'))
		    sum++;
		}
	}
	if(sum==strlen(zfc)-1){
	s=1;
	}
    return s;
}
/*
 * biaozhun.cpp
 *
 *  Created on: 2010-11-24
 *      Author: lz
 */

int main()
{
	int n;
	int i;
	char c[105][85];
	cin>>n;
	for(i=0;i<=n;i++)
		cin.getline(c[i],85);//?????????
	for(i=1;i<=n;i++)
	{
		int j=0;
		if(c[i][j]!='_'&&(c[i][j]<'A'||c[i][j]>'z'||(c[i][j]>'Z'&&c[i][j]<'a')))//??????
			cout<<"0"<<endl;
		else
		{
			j++;
			while(c[i][j]!='\0')
			{
				if(c[i][j]!='_'&&(c[i][j]<'0'||c[i][j]>'9'&&c[i][j]<'A'||c[i][j]>'Z'&&c[i][j]<'a'||c[i][j]>'z'))
					//????
				{
					cout<<"0"<<endl;
					break;
				}
				else
					j++;
			}
			if(c[i][j]=='\0')//??????
				cout<<"1"<<endl;
		}
	}
	return 0;
}
/*
 * no4.cpp
 *
 *  Created on: 2010-11-20
 *      Author: ???
 *      Title: ?????C????????
 */



int main()
{
	char str[82];		//??????
	int len,i,n,j;		//?????len??????
	cin>>n;		//??n
	cin.ignore();	//????????
	for (i=1;i<=n;i++)
	{
		memset(str,'\0',sizeof(str));	//?????
		cin.getline(str,90);	//?????
		len=strlen(str);	//???????
		if (str[0]!='_' && ( str[0]<65 || (str[0]>90 && str[0]<97) || str[0]>122))	//?????????????
		{
			cout<<0<<endl;	//????0
			continue;
		}
		for (j=1;j<len;j++)		//??????????????
		{
			if (str[j]!='_' && (str[j]<48 || (str[j]>57 && str[j]<65) || (str[j]>90 && str[j]<97) || str[j]>122))
			{
				cout<<0<<endl;	//??????0
				break;
			}
		}
		if (j==len)
			cout<<1<<endl;		//?????1
	}
	return 0;	//????
}
int main()
{
	char s[81];//???????
	int n;//????n
	cin>>n;//??n
	cin.get();//?????
	for(int i=0;i<n;i++)//????????
	{
		cin.getline(s,81);
		int ok=0;//??????
		if(s[0]=='_')  ok=1;
		if((s[0]<='z')&&(s[0]>='a'))  ok=1;
		if((s[0]<='Z')&&(s[0]>='A'))   ok=1;
		if(ok)//???????????
		{
			for(int j=1;s[j];j++)
				if((s[j]>='0')&&(s[j]<='9'))   ok=1;
				else if((s[j]<='z')&&(s[j]>='a'))  ok=1;
				else if((s[j]<='Z')&&(s[j]>='A'))   ok=1;
				else if(s[j]=='_')   ok=1;
				else {ok=0;break;}





		}

		cout<<ok<<endl;//??????


	}

    return 0;


}
int main(int argc, char* argv[])
{
	char s[LEN],a[5],*p;
	int n,i,ct;
	gets(a);
	n=atoi(a);
	for(i=0;i<n;i++){
		gets(s);
		ct=0;
		p=s;
		if((*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')||*p=='_'){
			p++;
			while(*p!=0){
				if((*p>='0'&&*p<='9')||(*p>='a'&&*p<='z')||(*p>='A'&&*p<='Z')||*p=='_')
					p++;
				else{
					ct++;
					break;
				}
			}
		}else
			ct++;
		if(ct<1)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int main()
{
	int i=0,k=0,n=0,flags=1,j=0;
	char a[81];
	cin>>n;
	cin.get();
	for(i=1;i<=n;i++)
	{
		cin.getline(a,81,'\n');
		k=strlen(a);
		flags=1;
		for(j=0;j<k;j++)
		{
			if(((int)a[j]<'a'||(int)a[j]>'z')&&((int)a[j]>'Z'||(int)a[j]<'A')&&((int)a[j]<'0'||(int)a[j]>'9')&&a[j]!='_')
				flags=0;
		}
		if(flags==0)
			cout<<0<<endl;
		else if((int)a[0]>='0'&&(int)a[0]<='9')
			cout<<0<<endl;
		else
			cout<<1<<endl;
	}
	return 0;
}