semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
// c??????
int main()
{
	int n,i,j;
	char str[100];
	cin >> n;
	cin.get();
	for(i = 0; i < n; i++)
	{
		cin.getline(str,100);
		for(j = 0; str[j] != '\0'; j++)
		{
			if(j == 0)
			{
				if(((str[j] - 'a') < 0 ||(str[j] - 'a') > 26)&&((str[j] - 'A') < 0 || (str[j] - 'A') > 26) && (str[j] != '_')) 
					break;
			}
            else if(((str[j] - '0') < 0 || (str[j] - '0') > 9) && ((str[j] - 'a') < 0 ||(str[j] - 'a') > 26)&&
				((str[j] - 'A') < 0 || (str[j] - 'A') > 26) && (str[j] != '_'))
				    break;
		}
		if(str[j] == '\0')
			cout << 1 << endl;
		else cout << 0 << endl;
	}
	
	return 0;
}
int main()
{
	int n , len ;
	char word[100];
	cin >> n;
	for ( int i = 0 ; i <= n ; i ++ )
	{
		cin.getline( word , 100000 );
		len = strlen( word );
		for ( int j = 0 ; j <= len - 1 ; j ++ )
		{
			if ( ( word[j] != '_' ) && ( word[j] < 65 || word[j] > 122 || ( word[j] > 90 && word[j] < 97 ) ) && ( word[j] < '0' || word[j] > '9' ) ) 
			{
				cout << 0 << endl;
				break;
			}
			if ( word[0] != '_' && ( word[0] < 65 || word[0] > 122 ) )
			{
				cout << 0 << endl;
				break;
			}
			if ( word[j] == ' ' )
			{
				cout << 0 << endl;
				break;
			}
			if ( j == len - 1 )
				cout << 1 << endl;
		}
	}
	return 0;
}
int main()
{int n;
cin>>n;
int t[100]; 
cin.get();
char a[100][80];
int i,j;
for(i=0;i<100;i++)
for(j=0;j<80;j++)
a[i][j]='\0';
for(i=0;i<n;i++)
cin.getline(a[i],81);

for(i=0;i<n;i++)
{if(!(a[i][0]>=65&&a[i][0]<=90||a[i][0]==95||a[i][0]>=97&&a[i][0]<=122))
{t[i]=0;
continue;}
                  for(j=0;j<80;j++)
{if(!(a[i][j]>=65&&a[i][j]<=90||a[i][j]==95||a[i][j]>=97&&a[i][j]<=122||a[i][j]>=48&&a[i][j]<=57||a[i][j]=='\0'))
{t[i]=0;
break;
}
 }
                 if(j==80)
t[i]=1;
}    
for(i=0;i<n;i++)    
{cout<<t[i]<<endl;
                    }    
     return 0;
    }
int work(char*input);
int compare(char a);
int main(int argc, char* argv[])
{
	int n=0,k=0;
	char n1[6],input[80];
           	gets(n1);
	n=atoi(n1);
	for(int i=0;i<n;i++)
	{
		gets(input);
		k=work(input);
		printf("%d\n",work(input));
	}
	return 0;
}
int work(char*input)
{
	char*p=input;
	char c='0';
	for(c='0';c<='9';c++)
	{
		if(*p==c)
			return 0;
	}
	int n=strlen(input);
	for(int i=0;i<n;i++)
	{
		if(compare(*(p+i))==0)
			return 0;
	}
	return 1;
}
int compare(char a)
{
	char c='0';
	for(c='0';c<='9';c++)
	{
		if(a==c)
			return 1;
	}
	for(c='A';c<='Z';c++)
	{
		if(a==c)
			return 1;
	}
	for(c='a';c<='z';c++)
	{
		if(a==c)
			return 1;
	}
   	if(a=='_')
	{return 1;}
	else return 0;
}
int main()
{
	int n,i,j,k;//??????n?????ij???k
	char a[100];//?????a
	cin>>n;
	cin.getline(a,100);
	for(i=1;i<=n;i++)
	{
		k=1;
		cin.getline(a,100);
		if((a[0]<'A')||((a[0]>'Z')&&(a[0]!='_')&&(a[0]<'a'))||(a[0]>'z'))
			k=0;
		for(j=1;j<strlen(a);j++)
			if((a[j]<'0')||((a[j]>'9')&&(a[j]<'A'))||((a[j]>'Z')&&(a[j]!='_')&&(a[j]<'a'))||(a[j]>'z'))
				k=0;
		cout<<k<<endl;//?????
	}
	return 0;
}
int main()
{
	int m;
	int i,j;
	char a[81]={'\0'};
	gets(a);
	m=atoi(a);
	for(i=0;i<=m-1;i++)
	{
		char a[81]={'\0'};
		int answer=1;
		gets(a);
		if(a[0]>=65&&a[0]<=90||a[0]>=97&&a[0]<=122||a[0]=='_')
		{
			for(j=1;a[j]!='\0';j++)
			{
				if(!(a[j]>=65&&a[j]<=90||a[j]>=97&&a[j]<=122||a[j]=='_'||a[j]>=48&&a[j]<=57))
				{
					answer=0;
					break;
				}
			}
		}
		else
		{
			answer=0;
		}
		printf("%d\n",answer);
	}
	return 0;
}
int main()
{
	char word[100][100];
	int i=0,j=0,len[100],n,judge[100]={0};
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(word[i],100,'\n');
	}
	for(i=0;i<n;i++)
	{
		j=0;
		while(word[i][j]!='\0')
		{
			j++;
		}
		len[i]=j;
	}
	for(i=0;i<n;i++)
	{
		if((word[i][0]>='a'&&word[i][0]<='z' || word[i][0]>='A'&&word[i][0]<='Z') || word[i][0]=='_')
		{
			judge[i]=1;
		    for(j=1;j<len[i];j++)
			{
				if((word[i][j]<'0' || (word[i][j]>'9'&&word[i][j]<'A') || (word[i][j]>'Z'&&word[i][j]<'a') || word[i][j]>'z') && word[i][j]!='_')
				{
					judge[i]=0;
				}	
			}
		}
	}
	for(i=0;i<n;i++)
	{
		cout<<judge[i]<<endl;
	}
	return 0;
}
/*
?? 
C???????????????????????????????????? 
????????????n????????????C???????????????1??????0
 
???? 
?????????????????????? 
?????????????80?????
 
???? 
???????????????????????1????????0???? 

?? 1000012760
*/


int Legal0(char s){
	if(s== '_')
		return 1;
	else if(((s> 64) && (s< 91)) || ((s> 96) && (s< 123)))
		return 1; 
	else
		return 0;
}

int Legal(char s){
	if(s== '_')
		return 1;
	else if(((s> 64) && (s< 91)) || ((s> 96) && (s< 123)))
		return 1;
	else if((s> 47) && (s< 58))
		return 1;
	else
		return 0;
}

int main(){

	char str[81];

	int i= 0, len= 0, sum, IsLegal, j= 0, n; 

	cin>>n;
	getchar();

	for(i= 0; i< n; i++){
		cin.getline(str, 81, '\n');
		sum= 0;
		for(len= 1; str[len]!= '\0'; len++);
			
		if(Legal0(str[0])== 1)  sum++;

		for(j= 1; j< len; j++){
			if(Legal(str[j])== 1)  sum++;			
		}

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

	return 0;
}
char s[100];
int pd(int);
int main()
{
    int n,i,j,q;    
    scanf("%d\n",&n);
    while(n)
    {   
        q=0;
        gets(s);
        for(i='a';i<='z';i++)
            if(s[0]==i) q=1;
        for(i='A';i<='Z';i++)
            if(s[0]==i) q=1;
        if(s[0]=='_') q=1;
        for(i=1;s[i]!='\0';i++)
             if(pd(i)==0) q=0;
        if(q==1) printf("1\n");
        else printf("0\n");
        n--;
    }
    return 0;
}
int pd(int t)
{
    int i,q;
    q=0;
    for(i=1;s[i]!='\0';i++)
    for(i='a';i<='z';i++)
        if(s[t]==i) q=1;
    for(i='A';i<='Z';i++)
        if(s[t]==i) q=1;
    if(s[t]=='_') q=1;
    for(i='0';i<='9';i++)
        if(s[t]==i) q=1;
    return q;
}
int main()
{
    int n;
    char sr[100][100];
    int i,j,sum[100];
    scanf("%d",&n);
 char ddd;
 scanf("%c",&ddd);
    for(i=0;i<n;i++) gets(sr[i]);
    for(i=0;i<n;i++)
 {
  sum[i]=0;
        for(j=0;sr[i][j]!='\0';j++)
  {
   if(j==0)
   {
    if( (sr[i][j]>='A'&&sr[i][j]<='Z')||
       (sr[i][j]>='a'&&sr[i][j]<='z')||
       (sr[i][j]=='_'))sum[i]=1; else
   {
    sum[i]=0;
    break;
   }
  }
   
   
   else if(j>0)
   {
   if ((sr[i][j]>='A'&&sr[i][j]<='Z')||
    (sr[i][j]>='a'&&sr[i][j]<='z')||
     (sr[i][j]=='_') || 
     (sr[i][j]>='0'&&sr[i][j]<='9'))sum[i]=1;
    else
   {
    sum[i]=0;
    break;
   }
  }
   
   
   else
   {
    sum[i]=0;
    break;
   }
  }
  if(sum[i]==0) printf("0\n");
  else printf("1\n");
 }                 
    
    return 0;
}
int biaozhi(char a[])
{
	int l,i;
	char *p;
	p=a;
	if((a[0]<='z'&&a[0]>='a')||(a[0]<='Z'&&a[0]>='A')||a[0]=='_')
	{
		for(i=1;i<strlen(a);i++)
		{
			if((*(p+i)<='z'&&*(p+i)>='a')||(*(p+i)<='Z'&&*(p+i)>='A')||*(p+i)=='_'||(*(p+i)>='0'&&*(p+i)<='9'))
			{
				l=1;
			}
			else
			{
				l=0;
				break;
			}
		}
		return l;
	}
	else
		return 0;
}
void main()
{
	int n,i;
	char a[85];
	scanf("%d ",&n);
	for(i=0;i<n;i++)
	{
		gets(a);
		if(biaozhi(a))
			printf("1\n");
		else
			printf("0\n");
	}
}
int main()
{
	int n, len, i;
	char ch[100];
	cin >> n;
	getchar();
	for (; n > 0; n--)
	{
		cin.getline(ch, 100);
		len = strlen(ch);
		i = 0;
		if (ch[0] >= '0' && ch[0] <= '9')
		{	
			cout << 0 << endl;
			continue;
		}
		while ((ch[i] <= 'z' && ch[i] >= 'a' || ch[i] <= 'Z' && ch[i] >= 'A' || ch[i] >= '0' && ch[i] <= '9' || ch[i] == '_')&& i < len)
			i++;
		cout << (i == len) << endl;
	}	
	return 0;
}
main()
{
int i,j,n,l,k=1;
char a[81];
char s[81];
scanf("%d",&n);
gets(s);
for(i=0;i<n;i++)
{

gets(s); //?c ?? ???? s ????? 
l=strlen(s);
a[0]=s[0];
if(a[0]<65||(90<a[0]&&a[0]<97&&a[0]!=95)||a[0]>122)
{
 printf("0\n"); 
                 //break;
 }
else             //else
{
                       for(j=1;j<l;j++) 
                       {
                                        a[j]=s[j];
                           if(a[j]<48||(a[j]>57&&a[j]<65)||(a[j]>90&&a[j]<95)||a[j]==96||a[j]>122)
                           {
                             printf("0\n");
                            break;
                            }                    
                        }
if(j==l)
printf("1\n");
}
}
getchar();
getchar();
getchar();
getchar();getchar();
getchar();getchar();
getchar();
}
int main(){
	int n,i,j,p;
	char a[100],b[100];
	cin>>n;
	cin.getline(b,100);
	for(i=1;i<=n;i++)
	{
		cin.getline(a,100);
		p=1;
		for(j=0;j<strlen(a);j++)
		{
			if((a[0]>='a'&&a[0]<='z'||a[0]>='A'&&a[0]<='Z'||a[0]=='_')==0)
			{
				cout<<0<<endl;p=0;break;
			}
			else if((a[j]>='a'&&a[j]<='z'||a[j]>='A'&&a[j]<='Z'||a[j]=='_'||a[j]>='0'&&a[j]<='9')==0)
			{
				cout<<0<<endl;p=0;break;
			}
		}
		if(p==1)cout<<1<<endl;
	}
	return 0;
}
int main()
{
	int n,i,j,flag=0;
	int a[100]={0};
	char ch[100];//????????
	cin>>n;
	cin.get();//????
	for(i=0;i<n;i++)
	{
	    cin.getline(ch,100);
	    for(j=0;j<strlen(ch);j++)
		{	if(ch[j]<48||(ch[j]>57&&ch[j]<65)||(ch[j]>90&&ch[j]<95)||ch[j]==96||ch[j]>122) flag++;//??????????
		}
		if(flag==0)
		{if((ch[0]==95)||(ch[0]>64&&ch[0]<91)||(ch[0]>=97&&ch[0]<123))//????????65~90??97~122??95
		a[i]=1;  }
		flag=0;
		//????????a[i]??1
		
	}
	for(j=0;j<n;j++)
		cout<<a[j]<<endl;//????????????
	return 0;
}
int main()
{
	int i,j=0,t,n,r;
    char str[100]={0};
    scanf("%d",&n);
	getchar();
	do{
		r=0;
		gets(str);
        t=strlen(str);
		for(i=0;i<t;i++)
		{
			if(i==0)
			{
				if(str[i]=='_')
					r++;
				if(str[i]>96&&str[i]<123)
					r++;
				if(str[i]>64&&str[i]<91)
					r++;
			}
			else
			{
				if(str[i]=='_')
					r++;
				if(str[i]>96&&str[i]<123)
					r++;
				if(str[i]>64&&str[i]<91)
					r++;
				if(str[i]>47&&str[i]<58)
					r++;
			}
		}
		if(r==t)
			printf("1\n");
		else
			printf("0\n");
		j++;
	}while(j<n);
	return 0;
}
int hefa_hou(char a)//???????????????????? 
{
    int pan;
    pan=a;
    if (((pan>=65)&&(pan<=90))||((pan>=97)&&(pan<=122))||(pan==95)||((pan>=48)&&(pan<=57))) return 1;//?????????????? 
    else return 0;
}
int hefa_qian(char a)//????????????? 
{
    int pan;
    pan=a;
    if (((pan>=65)&&(pan<=90))||((pan>=97)&&(pan<=122))||(pan==95)) return 1;//??????????? 
    else return 0;}
int main()
{
    int num,i,j,length,count;//num?????i,j?????length????count???? 
    char ming[81];
    cin>>num;
    for(i=0;i<num;i++)
    {
                      cin.get();//???? 
                      cin.get(ming,81);
                      length=strlen(ming);
                      count=0;//?? 
                      for(j=0;j<length;j++)
                      {
                                           if ((j==0)&&(hefa_qian(ming[0]))) count++;//??????? 
                                           if ((j!=0)&&(hefa_hou(ming[j]))) count++;//??????? 
                      }
                      if (count==length) cout<<"1"<<endl;
                      else cout<<"0"<<endl;
    }
    cin.get();cin.get();cin.get();cin.get();cin.get();
    return 0;
}
int main (){
char a[100];
int i,n,m=1;
int length;
char *p;
scanf("%d",&n);

for(i=0;i<n+1;i++){
gets(a);
    p=a;
	if(!( (*p=='_')|| (*p>64&&*p<91) || (*p>96&&*p<123) ) ){
		m=0;
	}
    length=strlen(a);
	for(p=a;p<a+length;p++){
		if(! ((*p=='_') || (*p>64&&*p<91) || (*p>96&&*p<123) || (*p>47&&*p<58) )){
					m=0;
					break;
		}
        
	}
	if(i>0){
	printf("%d\n",m);
	}
	m=1;
}
return 0;
}
int main()
{
	int n=0;
	cin>>n;
	cin.get();
	while(n-->0)
	{
		char str[100];
		int i=0,sum=0,h;
		cin.getline(str,100);
		h=strlen(str);
		for(i=1;i<h;i++)
		{
			if(((str[i]>='0')&&(str[i]<='9'))||((str[i]>='A')&&(str[i]<='Z'))||((str[i]>='a')&&(str[i]<='z'))||(str[i]=='_'))
			{
				sum=sum+1;
			}
		}
		if(((str[0]>='A')&&(str[0]<='Z'))||((str[0]>='a')&&(str[0]<='z'))||(str[0]=='_'))
		{
			sum=sum+1;
		}
		if(sum==h)
		{
			cout<<"1"<<endl;
		}
		if(sum!=h)
		{
			cout<<"0"<<endl;
		}
	}
	return 0;
}
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");
	}
}
int main()
{
	char str[200][81];
	int i, j, k, n, count;
	cin >> n;
	cin.get();
	for(k = 0; k < n; k++)
		cin.getline(str[k], 81);
	for(i = 0; i < n; i++)
	{
		count = 0;
		for(j = 0; str[i][j] != 0; j++)
		{
			if(str[i][0] != '_' && (str[i][0] < 'A' || str[i][0] > 'z'))
			{
				count++;
				break;
			}
			if(str[i][j] != '_' && (str[i][j] < 'A' || str[i][j] > 'z') && (str[i][j] < '0' || str[i][j] > '9'))
				count++;
		}
		if(count == 0)
			cout << "1" << endl;
		else cout << "0" << endl;
	}
	return 0;
}
int main()
{
	int n , i , k , len , f ;

	char c[ 99 ] ;

	cin >> n ;
	cin.get() ;

	for( i = 1 ; i <= n ; i ++ )
	{
		cin.getline( c , 99 ) ;

		len = strlen( c ) ;

		f = 0 ;

		if( ( c[ 0 ] < 'A' || ( c[ 0 ] > 'Z' && c[ 0 ] < 'a' ) || c[ 0 ] > 'z' ) && c[ 0 ] != '_' )
		{
			cout << 0 << endl ;
			continue ;
		}

		f = 1 ;

		for( k = 1 ; k < len ; k ++ )
		{
			if( ( c[ k ] >= 'A' && c[ k ] <= 'Z' ) || ( c[ k ] >= 'a' && c[ k ] <= 'z' ) || c[ k ] == '_' || ( c[ k ] >= '0' && c[ k ] <= '9' ) )
				f ++ ;
			else 
				f = 0 ;
		}

		if( f == len )
			cout << 1 << endl ;

		else 
			cout << 0 << endl ;
	}

	return 0 ;
}
int main()
{
	char sz[81];
	int i,n,judge;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		judge=0;
		if(i==0){
			getchar();
		}
		gets(sz);

		char *p;

		for(p=sz;p<sz+strlen(sz);p++){
			if(p==sz){
				if((*p>='A'&&*p<='Z')||(*p>='a'&&*p<='z')||*p=='_'){
					judge=1;
				}else{
					break;
				}
			}else{
				if((*p>='A'&&*p<='Z')||(*p>='a'&&*p<='z')||(*p>='0'&&*p<='9')||*p=='_'){
					judge=1;
				}else{
					judge=0;
					break;
				}
			}
		}
	
	printf("%d\n",judge);

	}

	return 0;
}
int main()
{
	int n,len,i,j,flag;
	char str[100];
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		gets(str);
		len=strlen(str);
		flag=1;
		if((str[0]>=65)&&(str[0]<=90)||(str[0]>=97)&&(str[0]<=122)||(str[0]=='_'))
			flag*=1;
		else
			flag*=0;
		for(j=1;j<len;j++)
		{
			if((str[j]>=65)&&(str[j]<=90)||(str[j]>=97)&&(str[j]<=122)||(str[j]=='_')||(str[j]>=48)&&(str[j]<=57))
				flag*=1;
			else
			{
				flag*=0;
				break;
			}
		}
		if(flag==1)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int islegal(char seq[],int size)
{
	int i,flag=1; char*ptr;
	ptr=seq;
	if(*ptr=='_'||isalpha(*ptr)!=0){
		for(i=1;i<size;i++){
			ptr=ptr+sizeof(char); 
			if(*ptr!='_'&&isalpha(*ptr)==0
				&&isdigit(*ptr)==0){
				flag=0;break;
			}
		}
	}else{
		flag=0;}
	return flag;	
}

int main()
{
	int n,i,len;
	char zfc[80000];
	gets(zfc);
	n=atoi(zfc);
	for(i=0;i<n;i++){
		gets(zfc);
		len=strlen(zfc);
		printf("%d\n",islegal(zfc,len));
	}
	return 0;
}
int main()
{
	int n,i,j,y[1000];
	char a[81];
	cin>>n;
	cin.get();
	for(i=0;i<1000;i++)
	{
		y[i]=0;
	}
	for(i=0;i<n;i++)
	{
		cin.getline(a,81);
		if(((a[0]-'a'<26)&&(a[0]-'a'>=0))||((a[0]-'A'<26)&&(a[0]-'A'>=0))||(a[0]=='_'))
		{
			y[i]=1;
			for(j=1;a[j]!=0;j++)
			{
				if(((a[j]-'a'<26)&&(a[j]-'a'>=0))||((a[j]-'A'<26)&&(a[j]-'A'>=0))||((a[j]-'0'<10)&&(a[j]-'0'>=0))||(a[j]=='_'))
				{
					y[i]=1;
				}
				else
				{
					y[i]=0;
					break;
				}
			}
		}
	}
	for(i=0;i<n;i++)
	{
		cout<<y[i]<<endl;
	}
	return 0;
}
int main()
{
	char ch[800][1000];
	int i,j,n,m=0;
	cin>>n;
	cin.get();
	for(i=1;i<=n;i++)
	{
		cin.getline(ch[i],100,'\n');
	}
	for(i=1;i<=n;i++)
	{
		if(ch[i][0]=='_'||(ch[i][0]<='z'&&ch[i][0]>='a')||(ch[i][0]<='Z'&&ch[i][0]>='A'))
		{
			    for(j=0;j<=(strlen(ch[i])-1);j++)
				{
					if(ch[i][j]!='_'&&(!(ch[i][j]<='z'&&ch[i][j]>='a'))&&(!(ch[i][j]<='Z'&&ch[i][j]>='A'))&&(!((ch[i][j]<='9'&&ch[i][j]>='0'))))
					{
						m++;
					}
				}	
			    if(m!=0)
				{
					cout<<"0"<<endl;
				}
                else
				{
					cout<<"1"<<endl;
				}
				m=0;
		}
		else
		{
			cout<<"0"<<endl;
		}
	}
	return 0;

}
int main()
{
	int num(char);
	int le(char);
	int n,i,len;
	char str[100];
	scanf("%d",&n);
	getchar();
	while(n--)
	{
	  gets(str);
	  len=strlen(str);
	  if(!le(str[0]))
	  {
  		printf("0\n"); continue;
  	  }	
  	  for(i=0;i<len;i++)
  	  {
  	  	if((!le(str[i]))&&(!num(str[i])))
  	  	  break;
  	  }
  	  if(i==len) printf("1\n");
  	  else printf("0\n");
	}
}
int le(char c)
{
	if('a'<=c&&c<='z') return 1;
	else if('A'<=c&&c<='Z') return 1;
	else if(c=='_') return 1;
	else return 0;
}
int num(char c)
{
	if('0'<=c&&c<='9') return 1;
	else return 0;
}
int main()
{
int n,x=1;
scanf("%d ",&n);
for (int i=0;i<n;i++)
   {
   x=1;
   char c[85];
   gets(c);
   if (!(c[0]=='_'||(c[0]>='a'&&c[0]<='z')||(c[0]>='A'&&c[0]<='Z'))) {printf("0\n");continue;} 
   for (int j=1;c[j]!='\0';j++)
      {
      if (c[j]=='_'||(c[j]>='0'&&c[j]<='9')||(c[j]>='a'&&c[j]<='z')||(c[j]>='A'&&c[j]<='Z')) continue;
      else {x=0;break;}
      }
   printf("%d\n",x);
   }
}
int main()//???????????,??????????
{
	int n;
	scanf("%d\n",&n);
	int *num;
	num=(int *)malloc(n*sizeof(int));
	int i,j;
	for(i=0;i<n;i++)
	{
		char *org;
		org=(char*)malloc(80*sizeof(char));
		gets(org);
		char *p;
		p=org;
		if(*p=='_'||isalpha(*p))
		{
			for(j=0;*(p+j)!='\0';j++)
			{
				if(isalpha(*(p+j))==0&&isdigit(*(p+j))==0&&*(p+j)!='_')
				{
					*(num+i)=3;					
				}
			}
			if(*(num+i)==3)*(num+i)=0;
			else *(num+i)=1;
			
		}
		else *(num+i)=0;
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n",*(num+i));
	}
}
int fit(char *p){
	if((*p>=65&&*p<=90)||(*p>=97&&*p<=122)||*p==95){
		p++;
	}else{
		return 0;
	}
	for(;*p!='\0';p++){
		if((*p>=65&&*p<=90)||(*p>=97&&*p<=122)||*p==95||(*p>=48&&*p<=57)){
			continue;
		}else{
			return 0;
		}
	}
	return 1;
}
int main(int argc, char* argv[])
{
	int n,i;
	char sz[81],*p;
	p=sz;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		gets(p);
		if(fit(p)){
			printf("1\n");
		}else{
			printf("0\n");
		}
	}
	return 0;
}
int main()
{
    int n, flag, i,j,m=0;
    char c[81];
    cin >> n;
    cin.get();
    for (i = 1; i <= n ; i ++)
    {
        cin.getline(c,81);
        flag = 1;
        if ((c[0] == '_') || (c[0] >= 'a' && c[0] <= 'z') || (c[0] >= 'A' && c[0] <= 'Z'))
        flag = 1;
        else flag = 0;
        j = 1;
        while(c[j] != '\0')
        {
             if ((c[j] >= 'a' && c[j] <= 'z')||(c[j] >= 'A' && c[j] <= 'Z')||(c[j] >= '0' && c[j] <= '9') || c[j] == '_')
              m ++;  /* ??????????,???????IF????*/
             else flag = 0;
             j ++;
         }
         cout << flag << endl;
    }
    return 0;
}
int main(){
int n , k , i , j;         //??????n????k?????i,j
    cin>>n;             //??????
    char c[81];          //???????
    cin.getline(c,81);    //?????
    for ( i = 1 ; i <= n ; i++){//????n????
    	k=1;                  //???k=1
    	char c[81];
    	cin.getline(c,81);
    	if( ( ( c[0] <= 'Z' )&&( c[0] >= 'A' ) ) || ( ( c[0] <= 'z' )&&( c[0] >= 'a' ) ) || ( c[0] == '_' ) ){
    		for(j=1 ; j < (int)strlen( c ) ; j++ ){
    			if( ( ( c[j] <= 'Z' )&&( c[j] >= 'A' ) ) || ( ( c[j] <= 'z' )&&( c[j] >= 'a' ) ) || ( c[j] == '_' ) || ( ( c[j] <= '9' )&&( c[j] >= '0' ) ) )
    				continue;          //??????????????????????
    			else {            //???k=0?????
    				k = 0;
    				break;
    			}
    		}
    	}
    	else              //???k=0
    		k = 0;
    	cout<<k;        //??k
    	if(i!=n)
    		cout<<endl;
    }
    return 0;         //????
	}
int main()
{
	int n,i,l,count;
	char sz[81];
	scanf("%d",&n);
	getchar();
	char *p;
	for(i=1;i<=n;i++){
		gets(sz);
		l=strlen(sz);
		p=sz;
		count=0;
		if((*p>='a' && *p<='z' )|| (*p>='A' && *p<='Z') || *p=='_'){
			for(p=sz+1;p<(sz+l);p++){
				if((*p>='a' && *p<='z') || (*p>='A' && *p<='Z') || *p=='_'||(*p>='0'&& *p<='9')){
					
				}else{
					count++;
				}
			}
		}else{
			count++;
		}
		if(count==0){
			printf("1\n");
		}else{
			printf("0\n");
		}
	}
		return 0;
}
char s[100];
int l;
int check()
{
 int i;
 if((s[0]<'A' || s[0]>'Z')&&(s[0]<'a' || s[0]>'z')&&(s[0]!='_')) return 0;
 for(i=0;i<l;i++)
  if((s[i]<'A' || s[i]>'Z')&&(s[i]<'a' || s[i]>'z')&&(s[i]!='_')&&(s[i]<'0' || s[i]>'9')) return 0;
 return 1;
}
int main()
{
int n,i,j;
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
 for(j=0;j<=99;j++)
	s[j]=0;
 l=0;
 scanf("%c",&s[0]);
 while(s[l]!='\n')
 {
	l++;
	scanf("%c",&s[l]);
 }
 
 printf("%d\n",check());
}
return 0;
}
int f(char c[]){
	int z,l=0,j;
	l=strlen(c);
	if(c[0]=='_'||(c[0]<91&&c[0]>64)||(c[0]<123&&c[0]>96)){
			for(j=0;j<l;j++){
				if(c[j]=='_'||(c[j]<='z'&&c[j]>='a')||(c[j]<='Z'&&c[j]>='A')||(c[j]<='9'&&c[j]>='0'))z=1;
				else{	
				return 0;
				break;
				}
		}
	}
	else{
	z=0;
		
	}
	return(z);
}
int main(int argc, char* argv[])
{	int n,i;char c[90];
	
	char s[10];  
   gets(s);
   n=atoi(s);
	for(i=0;i<n;i++){
	    gets(c);
	    printf("%d\n",f(c));
	}
	
	return 0;
}
int main()//???
{//?????
	int n=0;//???????
	char a[100][100]={"\0"};//??????
	int b[100]={0};
	int i=0,j=0;
	cin>>n;
	cin.get();//?????????
	for(i=0;i<n;i++)
	{
		gets(a[i]);//????????
	}
	for(i=0;i<n;i++)
	{
		if(a[i][0]=='_'||a[i][0]>='a'&&a[i][0]<='z'||a[i][0]>='A'&&a[i][0]<='Z')
			for(j=0;a[i][j]!='\0';j++)
			{
				if(a[i][j]>='0'&&a[i][j]<='9'||a[i][j]>='A'&&a[i][j]<='Z'||a[i][j]>='a'&&a[i][j]<='z'||a[i][j]=='_')
					b[i]=1;
				else 
				{
					b[i]=0;break;
				}
			}
		else
		{
			b[i]=0;continue;
		}
	}//????????????
	for(i=0;i<n;i++)
	{
		cout<<b[i]<<endl;
	}//?????1????0????
	return 0;
}//?????
main(){
	int n,i,t,j;
	cin>>n;
	char a[100];

	for (i=0;i<=n;i++){
      cin.getline(a,100);
      if (a[0]=='\0')
    	  continue;

    if (a[0]=='_' || (a[0]>='a' && a[0]<='z') || (a[0]>='A' && a[0]<='Z')) t=1; //??????????
	else {
		cout<<"0"<<endl;
		continue;
		}

	for (j=1;j<=strlen(a)-1;j++)                                                //????????
      if (!((a[j]>='0'&& a[j]<='9') || (a[j]>='a' && a[j]<='z') || (a[j]>='A' && a[j]<='Z') || a[j]=='_'))
      {t=0;
       break;
      }
	cout<<t<<endl;
	}
	return 0;
}
int main()
{
	int n,j,i,flag[100];
	char zf[100][100],shuzi[100];
	gets(shuzi);
	n=atoi(shuzi);
	for(i=0;i<n;i++)
	{
		flag[i]=1;
		gets(zf[i]);
	}
	for(i=0;i<n;i++)
	{
		if((zf[i][0]<'A')||((zf[i][0]>'Z')&&(zf[i][0]<'a')&&(zf[i][0]!='_'))||(zf[i][0]>'z'))
		{
			flag[i]=0;
		}
		for(j=1;j<strlen(zf[i]);j++)
		{
		if((zf[i][j]<'0')||(zf[i][j]<'A'&&zf[i][j]>'9')||((zf[i][j]>'Z')&&(zf[i][j]<'a')&&(zf[i][j]!='_'))||(zf[i][j]>'z'))
		    {
			    flag[i]=0;
		    }
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n",flag[i]);
	}
	return 0;
}
int main()
{
    int n,i,j,k,s;
    int l;
    char a[1000][100];
   scanf("%d",&n);
   getchar();
  for(i=0;i<n;i++)
  {
      gets(a[i]);           
  }
       
       for(i=0;i<n;i++)
       {
           s=strlen(a[i]);
            for(j=0;j<s;j++)
              {
                            k=a[i][j];
               //  if(a[i][j]!=' '&&a[i][j]!='.')
               //  l=0;
               //  else
              //   {
              //   l=1;
              //   break;
              //   }
                 if(k<123&&k>96)
                 l=0;
                 else if(k<91&&k>64)
                 l=0;
                 else if(a[i][j]=='_')
                 l=0;
                 else if(k<58&&k>47)
                 l=0;
                 else
                 {
                 l=1;
                 break;
                 }
              }
           if(l==0&&a[i][0]!='0'&&a[i][0]!='1'&&a[i][0]!='2'&&a[i][0]!='3'&&a[i][0]!='4'&&a[i][0]!='5'&&a[i][0]!='6'&&a[i][0]!='7'&&a[i][0]!='8'&&a[i][0]!='9')                
           printf("1\n");
           else
           printf("0\n");
       }            

              
  
     
    getchar();
    getchar();
    
}
/*
 * 111202_6_AcceptableIdentifier.cpp
 *
 *  Created on: 2011-12-4
 *      Author: Alfalfa
 */
void judge(char word[81]){ //??????
	int len=strlen(word),flag=0;
	if(word[0]<'A'||(word[0]>'Z'&&word[0]<'_')||(word[0]>'_'&&word[0]<'a')||word[0]>'z') { cout<<0<<endl; flag=1;} //????????? ???0
	else for(int i=1;i<len;i++){
		if(word[i]<'0'||(word[i]>'9'&&word[i]<'A')||(word[i]>'Z'&&word[i]<'_')||(word[i]>'_'&&word[i]<'a')||word[i]>'z'){
			cout<<0<<endl;
			flag=1;
			break; //??????
		}
	}
	if(flag==0) cout<<1<<endl; //??????????1
}

int main(){
	int n,j;
	cin>>n;
	char a[81],b[81];
	cin.getline(b,81);
	for(j=0;j<n;j++){
		cin.getline(a,81);
		judge(a);
	}
	return 0;
}