semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	int n;
	cin>>n;
	char c;
	c=getchar();
	int flag=1,first=1;
	while(c=getchar()){
		if(c=='\n'){
			if(flag)cout<<1<<endl;
			else cout<<0<<endl;
			flag=1;first=1;n--;
			if(n==0)return 0;
		}else{
			if(first){
				flag=(c=='_'||(c>='a'&&c<='z')||(c>='A'&&c<='Z'));	
				first=0;
			}else{
				flag=flag&&((c=='_')||(c>='a'&&c<='z')||(c>='A'&&c<='Z')||(c>='0'&&c<='9'));
			}
		}	
	}
	return 0;
}
int main()
{
 
	char a[100][100];
	int n,i,j,l[100],check=1;//???????
	cin>>n;
	cin.get();           //????
	for(i=0;i<n;i++)
		gets(a[i]);//??
		for(i=0;i<n;i++)
		{l[i]=strlen(a[i]);}
		
	for(i=0;i<n;i++)
	{for(j=1;j<l[i];j++)
	      {if(a[i][j]!=95&&(a[i][j]<'0'||(a[i][j]>'9'&&a[i][j]<'A')||(a[i][j]>'Z'&&a[i][j]<'a')||a[i][j]>'z')) //????
	{check=0;break;}        }
	
		if((a[i][0]=='_'||(a[i][0]>='A'&&a[i][0]<='z'))&&check==1) //????
			cout<<"1"<<endl;
		else
		{cout<<"0"<<endl;check=1;}
	}
	return 0;
	
}
int panduan(char a)
{
    if(a>='0'&&a<='9')
    return 0;
    if(a>='a'&&a<='z')
    return 0;
    if(a>='A'&&a<='Z')
    return 0;
    if(a=='_')
    return 0;
    return 1;
}
int main()
{
    char a[81];
    int k;
    scanf("%d\n",&k);
    for(int j=0;j<k;j++)
    {
                       gets(a);
                       int n=strlen(a);
                       if(!(a[0]=='_'||(a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')))
                       {
                       printf("0\n");
                       continue;
                       }
                       else
                       for(int i=0;i<n;i++)
                       {
                               if(panduan(a[i]))
                               {
                                  printf("0\n");
                                  goto end;
                               }
                       }
                       printf("1\n");
                       end:;
    }
}
void main()
{
	char s[81];
	int n,i,j,temp=0,k;
	scanf("%d",&n);getchar();
	for(i=0;i<n;i++)

	{
		gets(s);
		
		
		if(strlen(s)==1)
		{
			if(s[0]=='_'||(s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z'))
				printf("1\n");
			else
				printf("0\n");
		}
		if(strlen(s)>1)
		{
			if((s[0]=='_')||(s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z'))
			{
				for(j=1;j<strlen(s);j++)
				{
					if(s[j]<='9'&&s[j]>='0')temp++;
					if(s[j]=='_')temp++;
					if(s[j]>='a'&&s[j]<='z')temp++;
					if(s[j]>='A'&&s[j]<='Z')temp++;
						
					/*if(s[j+1]==' ')
						temp--;*/
				}
			
				if(temp==(strlen(s)-1))
					printf("1\n");
			}
			if(temp!=(strlen(s)-1))
				printf("0\n");
			temp=0;
		
		/*for(k=0;k<strlen(s);k++)
		{
			if(s[k]==' ')
				printf("0\n");
			else;
		}*/
		}
	}
}
/*
 * ?????????C????????.cpp
 * ?????
 * Created on: 2010-11-24
 * Author: ???
 */
int main()//???
{
	char a[82];//?????????
	memset(a,0,sizeof(a));
	int b,i,j,k;//????
	int m;
	cin>>b;//??????
	gets(a);//????????????"\n"
	for(i=1;i<=b;i++)//B???
	{
		gets(a);//??
		k=strlen(a);
		if((a[0]=='_')||((a[0]>='A')&&(a[0]<='Z'))||((a[0]>='a')&&(a[0]<='z')))
			//?????????????
		{
			for(j=1,m=0;j<k;j++)
			{
				if((a[j]=='_')||((a[j]>='A')&&(a[j]<='Z'))||((a[j]>='a')&&(a[j]<='z'))||((a[j]>='0')&&(a[j]<='9')))
					//?????????????????
				{
					m++;//?????????
				}
			}
			if(m==k-1)//??????
				cout<<1<<endl;//??1
			else
				cout<<0<<endl;//????0

		}
		else
			cout<<0<<endl;//????????????0
	}
	return 0;//??
}
int no()
{
    cout << 0 << endl;
    return 0;
}

int yes()
{
    cout << 1 << endl;
    return 0;
}


int main()
{
    char s[300];
    int i, n, k;
    cin >> n;
    getchar();
    for(k=1; k<=n; k++)
    {
        gets(s);
        if(!((s[0]>='A' && s[0]<='Z')||(s[0]>='a' && s[0]<='z')|| s[0]=='_'))
        {
            no();
            continue;
        }
        for(i=0; s[i]!='\0'; i++)
        {
            if(!((s[i]>='A' && s[i]<='Z')||(s[i]>='a' && s[i]<='z')||(s[i]>='0' && s[i]<='9')|| s[i]=='_'))
            {
                no();
                break;
            }
        }
        if(s[i]=='\0')
            yes();
    }
    return 0;
}
int main()
{
	int n;
	char str[100][100];
	
	cin >> n;
	cin.get();
	
	for (int i = 0; i < n; i ++)
	{
		cin.getline(str[i] , 100); 

		int f = 0;
		for (int j = 0; str[i][j] != 0; j ++)
			if (str[i][j] != '_' && ((str[i][j] > 'z') || (str[i][j] < 'A') || (str[i][j] > 'Z' && str[i][j] < 'a')))
				if (j == 0 || str[i][j] < '0' || str[i][j] > '9')
				{
					cout << "0" << endl;
					f = 1;
					break;
				}
		if (f == 0)
			cout << "1" << endl;
	}		

	return 0;
}
int hefa(char*a){
	for (;*a=='_'||(*a>='A' &&*a<='Z')||(*a>='a' &&*a<='z')||(*a>='0' &&*a<='9')||*a=='\0';a++)
	{
		if (*a=='\0')
		{
			printf("1\n");
			return 0;
		}else if (!(*a=='_'||(*a>='A' &&*a<='Z')||(*a>='a' &&*a<='z')||(*a>='0' &&*a<='9')))
		{
			printf("0\n");
			return 0;
		}
	}
	printf("0\n");
	return 0;
}
int main(){
	char zifu[2000000];
	char *p;
	int i,n;
	scanf("%d",&n);
	getchar();
	for (i=0;i<n;i++)
	{
		gets(zifu);
		p=zifu;
		if (*p=='_'||(*p>='A' &&*p<='Z')||(*p>='a' &&*p<='z'))
		{
			hefa(p);
		} 
		else
		{
			printf("0\n");
		}
	}
	return 0;
}
//????????C????????
int main()
{
	int n,num,panduan[100],flag,i,j;  //????n??????num?10???????????????????????flag
	char ch[100][81],huiche[1];       //???ch???????????huiche

	cin>>n;                           //??????
	cin.getline(huiche,1,'\n');       //????
	for(i=0;i<n;i++)cin.getline(ch[i],81,'\n');//??n????

	for(i=0;i<n;i++)
	{
		num=0;
		flag=0;
		
		for(j=0;j<81;j++)
		{
			if(ch[i][j]!='\0')num=num+1;//???????
			else break;
		};

		if((ch[i][0]=='_' || (65<=ch[i][0] && ch[i][0]<=90) || (97<=ch[i][0] && ch[i][0]<=122))==0)panduan[i]=0;//???????????
		else
		{
			for(j=1;j<num;j++)
			{
				if(ch[i][j]=='_' || (65<=ch[i][j] && ch[i][j]<=90) || (97<=ch[i][j] && ch[i][j]<=122) || (48<=ch[i][j] && ch[i][j]<=57))flag=flag+1;
			};

			if(flag==num-1)panduan[i]=1; //???????????????????????
			else panduan[i]=0;
		};

	};

	for(i=0;i<n;i++)cout<<panduan[i]<<endl;//????

	return 0;
};
int main()
{
	int n;
	int i,j;
	int flag=0;
	char s[100]={0};
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		flag=0;
		cin.getline(s,100);
		 //cout<<s[0]<<"check";
		for(j=0;j<strlen(s);j++)
		{
			if((s[0]!='_'&&(s[0]>'Z'||s[0]<'A')&&(s[0]>'z'||s[0]<'a'))||s[j]!='_'&&(s[j]>'9'||s[j]<'0')&&(s[j]>'Z'||s[j]<'A')&&(s[j]>'z'||s[j]<'a'))
			{	
				cout<<"0"<<endl;
				flag=1;
				break;
			}
		}
		if(flag==0)
			cout<<"1"<<endl;
		
	}
	return 0;
}
int main()
{
       char c[81];
       int i,j,n,a,length,p,q;
       scanf("%d",&n);
       getchar();
       for(i=0;i<n;i++)
       {
               gets(c);
               length=strlen(c);
               p=0;
               q=0;
               if(c[0]=='_'||(c[0]>64&&c[0]<91)||(c[0]>96&&c[0]<123))
                       p=1;
               else
               {
                       p=0;
               }
               for(j=0;j<length;j++)
               {
                       if(c[j]=='_'||(c[j]>64&&c[j]<91)||(c[j]>96&&c[j]<123)||(c[j]>47&&c[j]<58))
                               q=1;
                       else
                       {
                               q=0;
                               break;
                       }
               }
               if(p&&q)
                       a=1;
               else
                       a=0;
               printf("%d\n",a);
       }
       return 0;
}
int main()
{
	int n,i, mm=0,j,len;
	char s[90];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
	gets(s);len=strlen(s);
				for(j=0;j<len;j++)
				{
	             if(  (s[j]>=48&&s[j]<=57) ||  (s[j]>=65&&s[j]<=90)  || (s[j]>=97&&s[j]<=122)  ||  (s[j]=='_') )  mm=0;
				
				 else {mm=1;break;}}

				
	if(mm==0&&(s[0]=='_'||(s[0]>=65&&s[0]<=90)||  (s[0]>=97&&s[0]<=122) ))
		printf("1\n");
	else 
	 printf("0\n");
	
				}

	
	
return 0;
}
void main()
{
	int n,i,result=0;
	char c;

	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		c=getchar();
		if(!(c=='_'||isalpha(c))){
			printf("%d\n",result);
			while(getchar()!='\n');
			continue;
		}

		while(1){
			if(!(c=='_'||isalnum(c))){
				result=0;
				while(getchar()!='\n');
				break;
			}
			else result=1;
			if((c=getchar())=='\n') break;
		}
		printf("%d\n",result);
		result=0;
	}
}
int main()
{
       char x[81];
       int lx,n,i,j,flag[100];
       cin>>n;
       getchar();
       for(i=1;i<=n;i++)
       {
              flag[i]=1;
              cin.getline(x,81,'\n');
              for(lx=0;x[lx]!=0;lx++);
              if((x[0]>=65&&x[0]<=90)||(x[0]>=97&&x[0]<=122)||x[0]=='_')
              {
                 //cout<<1;
                 for(j=1;j<=lx-1;j++)
                 {
                                     if(((x[j]<48)||(x[j]>57&&x[j]<65)||(x[j]>90&&x[j]<97)||(x[j]>122&&x[j]))&&x[j]!='_')
                                     {
                                        flag[i]=0;break;
                                     }
                 }
                 
              }
              else flag[i]=0;
              
       }
       for(i=1;i<=n;i++)
       {
                        cout<<flag[i]<<endl;
       }
      
       return 0;
}
int main ()
{
	int n,i,j,m,l;
	cin >>n;
	char b;
	char a[100];
	for (i=0;i<n;i++)
	{
		l=1;
		cin.get(b);
		cin.get(a,100,'\n');
	j=0;
	int k=0;
	while(a[j]!='\0')
	{
		j++;
		k++;
	}
	
	if ((a[0]==95)||(a[0]>64&&a[0]<91)||(a[0]>96&&a[0]<123))
	{
		for (m=1;m<k;m++)
		{
			if (!((a[m]==95)||(a[m]>64&&a[m]<91)||(a[m]>96&&a[m]<123)||(a[m]>47&&a[m]<58)))
			{cout <<0<<endl;
			l=0;
			break;}
		}
		if (l)cout <<1 <<endl;
	}
	else  cout <<0<<endl;
	}
	return (0);
}
int main()
{
    char sen[200][90];
	int  i,n,p,j,len,q;
	cin>>n;
	cin.ignore();
	for(i=1;i<=n;i++)
	{
		cin.getline(sen[i],90);
		
	    
	
	}
	
	
	  for(i=1;i<=n;i++)
	  {
		 q=0;
		 p=0;
		 len=strlen(sen[i]);
		 if(len==1)
		 {
		   if(sen[i][0]=='_'||(sen[i][0]>='a'&&sen[i][0]<='z')||(sen[i][0]>='A'&&sen[i][0]<='Z'))
		   {
			   cout<<1<<endl;continue;
		   }
           
		 }   
	    else
		   {
          
		        for(j=1;j<=len-1;j++)
				{
			      
			      if(sen[i][0]=='_'||(sen[i][0]>='a'&&sen[i][0]<='z')||(sen[i][0]>='A'&&sen[i][0]<='Z'))
				  {
				      p=1;
				  }
			       if((sen[i][j]>='a'&&sen[i][0]<='z')||(sen[i][j]>='A'&&sen[i][j]<='Z')||(sen[i][j]>='0'&&sen[i][j]<='9')||(sen[i][j]=='_'))
				   {
				      q=1;
				   }
		    	   else
				   {
				      q=0;break;
				   }
            
				}
		 
		     
		       if(p==1&&q==1)
			   {
			       cout<<1<<endl;
			   }
		       else
			   {
			    cout<<0<<endl;
			   }
		   }
	

	  }
    
    return 0;

}
int i,j;
int main()
{
	int n;
	char a[81];
	cin>>n;
	getchar();
	for (i=0;i<n;i++)
	{
		int l,p=0,q=0;
		cin.getline(a,81);
		l=strlen(a);
		if (a[0]=='_'||(a[0]>='A'&&a[0]<='Z')||(a[0]<=122&&a[0]>=97))
			p=1;
		else p=0;
		q=1;
		for (j=1;j<l;j++)
		{
			if (a[j]=='_'||(a[j]>='A'&&a[j]<='Z')||(a[j]<=122&&a[j]>=97)||(a[j]>='0'&&a[j]<='9'))
				continue;
			else 
			{
				q=0;
			}
		}
		if (p==0) cout<<"0"<<endl;
		if (p==1&&q==1) cout<<"1"<<endl;
		if (p==1&&q==0) cout<<"0"<<endl;
	}
	return 0;
}
//?????C????????
//??????
//??????????C????????

int main()
{
    int n,hefa[100]={0};                     //n????????hefa???????????
	cin>>n;                                  //??n
	cin.get();                               //????????
	for (int i=0;i<n;i++)                    //i?????
	{
		char ch[81]={'\0'};                  //?????????
		int lench;                           //???????
		cin.getline(ch,81,'\n');             //?????
		for(lench=0;lench<81;lench++)
			if (ch[lench]=='\0') break; //???????
		
		if ((ch[0]!='_') && (ch[0]>'Z'||ch[0]<'A') && (ch[0]>'z'||ch[0]<'a'))
			hefa[i]=1;                       //?????????????hefa[i]?1
		else if(lench>1)                     //??????????????1
			for(int j=1;j<lench;j++)         //j?????
				if ((ch[j]!='_') && (ch[j]>'Z'||ch[j]<'A') && (ch[j]>'z'||ch[j]<'a') && (ch[j]>'9'||ch[j]<'0'))
				{
					hefa[i]=1;
					break;
				}                            //??ch[j]???????????hefa[i]?1??????
				else;
		else;		                         //???????????1??hefa[i]??????0
	}
	for (int k=0;k<n;k++)
		if(hefa[k]==0) cout<<1<<endl;        //hefa[k]?0???????????1
		else cout<<0<<endl;                  //hefa[k]?1????????????0
		return 0;
}
int main(){
    char n[100];
    gets(n);
    int m=atoi(n);
    for(int j=0;j<m;j++){
            int bar=0;
            char a[100];
            gets(a);
            int len=strlen(a);
            if((a[0]<=90&&a[0]>=65)||a[0]==95||(a[0]>=97&&a[0]<=122)){
                        for(int i=0;i<len&&bar==0;i++){
                                      if((a[i]<65&&a[i]>57)||a[i]<48||(a[i]>90&&a[i]<97&&a[i]!=95)||a[i]>122){
                                               bar=1;
                                      }
                        }
                        if(bar==1){
                                   bar=0;
                        }
                        else if(bar==0){
                                   bar=1;
                        }
            }
            if(bar==0){
                 printf("0\n");
            }
            if(bar==1){
                 printf("1\n");
           }
    }   
    return 0;
}
int f(int x)
{
 int k,m;
 for(k=0;k<=9;k++)
 {if(x==k)
  break;
  }
  if(k>9)  m=0;
  else m=1;
  return m;
}
main()
{
 int n,i,j,l;
 char a[80],b[5];
 gets(b);
 n=atoi(b);
 for(j=0;j<n;j++)
 {
  gets(a);
  l=strlen(a);
  

  if((a[0]=='_')||((a[0]>='A')&&(a[0]<='Z'))||((a[0]>='a')&&(a[0]<='z')))
  { 
  for(i=1;i<l;i++)
  {   if((a[i]=='_')||((a[i]>='A')&&(a[i]<='Z'))||((a[i]>='a')&&(a[i]<='z')))
     continue;
     else if(f(a[i]-'0')==1)
     continue;
     else break;
  }
  if(i==l||i==l+1)
  printf("1\n");
  else
  printf("0\n");
 }
  else
  printf("0\n");
}

  getchar();
  getchar();
  getchar();
  getchar();
}
int judge(char *,int );

int main()
{
	char str[100],*p=str,nc[2];

	int n,i;

	gets(nc);

	n=atoi(nc);

	for(i=0;i<n;i++){
		gets(p);

		
	
	    printf("%d\n",judge(p,strlen(p)));
	}
	
	return 0;
}

int judge(char *a,int x){
	if(*a=='_'||(*a<='z'&&*a>='a')||(*a<='Z'&&*a>='A')){
		int i;
		for(i=1;i<x;i++){
			if(*(a+i)!='_'&&!(*(a+i)<='z'&&*(a+i)>='a')&&!(*(a+i)<='Z'&&*(a+i)>='A')&&!(*(a+i)>='0'&&*(a+i)<='9'))
				return 0;
		}
		return 1;
	
	}

		
		
	else
		return 0;
}
int main(){
    int n,i,j,len[100];
    char s[100][81],num[10];
    gets(num);
    n=atoi(num);
    for(i=0;i<n;i++){
        gets(s[i]);
        len[i]=strlen(s[i]);
    } 
    for(i=0;i<n;i++){
        if((*s[i]==95)||(*s[i]>=65&&*s[i]<=90)||(*s[i]>=97&&*s[i]<=122)){
            if(len[i]==1)
                printf("1\n");
            else{
                for(j=1;j<len[i];j++){
                    if((s[i][j]<=47)||(s[i][j]>=58&&s[i][j]<=64)||(s[i][j]>=91&&s[i][j]<=94)||(s[i][j]==96)||(s[i][j]>=123)){
                        printf("0\n");
                        break;
                    }
                    if(j==len[i]-1)
                        printf("1\n");
                }
            }
        }
        else
            printf("0\n");
    }
    return 0;
}
char s[100];
int main(void)
{
	//freopen("in.txt","r",stdin);
	int i,j,k;
	char c;
	int n;
	scanf("%d",&n);
	while(n--)
	{
		while(1)
		{
			c=getchar();
			if(c!='\n')
			    break;
		}
		i=0;
		while(c!='\n')
		{
			s[i++]=c;
			c=getchar();
		}
		s[i]='\0';
		//printf("%s\n",s);
		if(s[0]=='_'||s[0]>='a'&&s[0]<='z'||s[0]>='A'&&s[0]<='Z')
		{
			int ok=1;
			for(i=1;i<strlen(s);i++)
			{
				if(s[i]=='_'||s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'||s[i]>='0'&&s[i]<='9')
				    ;
				else
				{
					ok=0;
					break;
				}
			}
			if(ok==1)
			    printf("1\n");
			else
			    printf("0\n");
		}
		else
			printf("0\n");
	}
	return 0;
}
// ?????C????????.cpp : ??????????????
//



int main()
{
	int n,i,j,l;
	char a[81];
	scanf("%d\n",&n);
	for(i=1;i<=n;++i)
	{
		gets(a);
		l=strlen(a);
		if((a[0]<65)||(a[0]>90&&a[0]<95)||(a[0]==96)||(a[0]>122)) printf("0\n");
		else 
		{
			for(j=1;j<l;++j)
			{
				if((a[j]>=48&&a[j]<=57)||(a[j]>=65&&a[j]<=90)||(a[j]==95)||(a[j]>=97&&a[j]<=122)) ;
				else break;
			}
			if(j==l) printf("1\n");
			else if(j<=l-1) printf("0\n");
		}
	}
	return 0;
}
int main()
{
	int n, i, j, mark[1000], k, l, m;
	char a[1000][81];
	cin >> n;
	for (m = 0; m < n; m++)
	{
		mark[m] = 1;
	}
	cin.ignore();
	for (i = 0; i < n; i++)
	{
		cin.getline(a[i], 81);
	}
	for (j = 0; j < n; j++)
	{
		if ((0 > a[j][0] - 'a'||a[j][0] - 'a' >25)
				&&(0 > a[j][0] - 'A'||a[j][0] - 'A' > 25)
				&&a[j][0] != '_')
		{ mark[j] = 0; continue; }
		for (k = 1; k < strlen(a[j]); k++)
		{
			if ((0 > a[j][k] - 'a'||a[j][k] - 'a' >25)
				&&(0 > a[j][k] - 'A'||a[j][k] - 'A' > 25)
				&&(0 > a[j][k] - '0'||a[j][k] - '0' > 9)&&
				a[j][k] != '_')
			{ mark[j] = 0; break; }
		}
	}
	for (l = 0; l < n; l++)
	{
		cout << mark[l] << endl;
	}
	return 0;
}
int main(){
	int i,u,n,len,flag;
	char str[1000][81],num[10];
	gets(num);
	n=atoi(num);
	for(i=0;i<n;i++){
		flag=1;
		gets(str[i]);
		len=strlen(str[i]);
		if((str[i][0]=='_')||(str[i][0]>='a'&&str[i][0]<='z')||(str[i][0]>='A'&&str[i][0]<='Z')){
			for(u=0;u<len;u++){
				if(str[i][u]=='_'||(str[i][u]>='a'&&str[i][u]<='z')||(str[i][u]>='A'&&str[i][u]<='Z')||(str[i][u]>='0'&&str[i][u]<='9')){
					continue;
				}else{
					flag=0;
					break;
				}
			}
		}else{
			flag=0;
		}
		printf("%d\n",flag);
	}
	return 0;
}
int main()
{
	int n,i,j;char s[100][81];int g;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
		gets(s[i]);
	for(i=0;i<n;i++)
	{
		g=0;
		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')))
				{  
					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'))g++;
				}


				
			}
				if(g==strlen(s[i]))cout<<1<<endl;
				else cout<<0<<endl;
	}
     return 0;
}
int main()
{
int i,j,n,len,flag=0;
char a[50000][82];
char str[100];
//scanf("%d",&n);
gets(str);
n=atoi(str);
for(i=0;i<n;i++)
gets(a[i]);
for(i=0;i<n;i++)
{flag=0;
if(a[i][0]=='_'||(a[i][0]>=65&&a[i][0]<=90)||(a[i][0]>=97&&a[i][0]<=122))
  {
   len=strlen(a[i]);
    for(j=0;j<len;j++)
     {
        if(a[i][j]=='_'||(a[i][j]>=65&&a[i][j]<=90)||(a[i][j]>=97&&a[i][j]<=122)||(a[i][j]>=48&&a[i][j]<=57))
        flag=1;
else
flag=0;
        if(flag==0) break;
      }

  }
if(flag==1) printf("1\n");
else printf("0\n");
}
return 0;
}
int judge(char a)
{
	int flag=0;
	if(a==95||(a>64&&a<91)||(a>96&&a<123))
		flag=1;
	return flag;
}

int main()
{
	char words[100][100]={{0}};
	int n=0;int i=0,j=0,space=0;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(words[i],100,'\n');
		for(j=0;j<100;j++)
		{
			if((words[i][j]>64&&words[i][j]<91)||(words[i][j]>96&&words[i][j]<123)||(words[i][j]>47&&words[i][j]<58)||words[i][j]==95) continue;
			else 
			{
				if(words[i][j]!=0)
				{
				space=1;
				cout<<"0"<<endl;
				break;
				}
			}
		}
		if(space==0)
		    cout<<judge(words[i][0])<<endl;
		space=0;
	}
	return 0;
}
void main()
{
    int n,i,j,k;
    char str[100][100];
    scanf("%d",&n);
    gets(str[0]);
    for(i=0;i<n;i++)
    gets(str[i]);
    for(i=0;i<n-1;i++)
    {
        k=1;
        for(j=0;str[i][j]!='\0';j++)
        {
            if(j==0)
            if((str[i][j]>'z'||str[i][j]<'a')&&(str[i][j]>'Z'||str[i][j]<'A')&&str[i][j]!='_')
            {
                printf("0\n");
                k=0;
                break;
            }
            if(j!=0)
            if((str[i][j]>'z'||str[i][j]<'a')&&(str[i][j]>'Z'||str[i][j]<'A')&&(str[i][j]<'0'||str[i][j]>'9')&&str[i][j]!='_')
            {
                printf("0\n");
                k=0;
                break;
            }
        }
        if(k)printf("1\n");
    }
    k=1;
    for(j=0;str[n-1][j]!='\0';j++)
    {
        if(j==0)
        if((str[i][j]>'z'||str[i][j]<'a')&&(str[i][j]>'Z'||str[i][j]<'A')&&str[i][j]!='_')
        {
            printf("0");
            k=0;
            break;
        }
        if(j!=0)
        if((str[i][j]>'z'||str[i][j]<'a')&&(str[i][j]>'Z'||str[i][j]<'A')&&(str[i][j]<'0'||str[i][j]>'9')&&str[i][j]!='_')
        {
            printf("0");
            k=0;
            break;
        }
    }
    if(k)printf("1");
}
int why(char *s)
{
	int i;
	if(s[0]=='_' || (s[0]>='a' && s[0]<='z') || (s[0]>='A' && s[0]<='Z'))
		for(i=1;s[i];i++)
			if(s[i]=='_' || (s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') || (s[i]>='0' && s[i]<='9'))
				continue;
			else
				return 0;
	else
		return 0;
	return 1;
}
int main()
{
	char s[1000];
	int n,i;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		gets(s);
		printf("%d\n",why(s));
	}
	return 0;
}
void main()
{
	int n,i,j,m,k;
	scanf("%d",&n);
	char a[10000][81];
	getchar();
	for(i=0;i<n;i++)
		gets(a[i]);
	char (*p)[81];
	p=a;
	for(i=0;i<n;i++)
	{
		k=0;
		m=0;
		if((*(*(p+i)+0)>='A'&&*(*(p+i)+0)<='Z')||*(*(p+i)+0)=='_'||(*(*(p+i)+0)>='a'&&*(*(p+i)+0)<='z'))
			k=1;
		for(j=0;*(*(p+i)+j)!='\0';j++)
		{
			if((*(*(p+i)+j)>='0'&&*(*(p+i)+j)<='9')||(*(*(p+i)+j)>='A'&&*(*(p+i)+j)<='Z')||*(*(p+i)+j)=='_'||(*(*(p+i)+j)>='a'&&*(*(p+i)+j)<='z'))
				m=m+0;
			else
				m=m+1;
		}
		if(k==1&&m==0)
			printf("1\n");
		else
			printf("0\n");
	}
}
int main()
{
	char a[81];
	int i,j,l,n,g;
	cin>>g;
	cin.get();
	for(j=0;j<g;j++)
	{
		cin.getline(a,81);
		for(n=0;a[n]!=0;n++);
		l=0;
		if(a[0]=='_'||(a[0]-'a'<26&&a[0]-'a'>=0)||(a[0]-'A'>=0&&a[0]-'A'<26))
		{
			l=1;
			for(i=1;i<n;i++)
			{
				if(a[i]=='_'||(a[i]-'a'<26&&a[i]-'a'>=0)||(a[i]-'0'>=0&&a[i]-'0'<10)||(a[i]-'A'>=0&&a[i]-'A'<26))
				{
					l=1;
				}
				else
				{
					l=0;
					break;
				}
			}
		}
		cout<<l<<endl;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,j,flag;
	char str[81];
    scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		flag=0;
		gets(str);
		if(str[0]=='_'||str[0]>='a'&&str[0]<='z'||str[0]>='A'&&str[0]<='Z')
		{
			for(j=0;str[j];j++)
			{
				if(str[j]=='_'||str[j]>='a'&&str[j]<='z'||str[j]>='A'&&str[j]<='Z'||str[j]>='0'&&str[j]<='9')
					continue;
				else
				{
					flag=1;
					break;
				}
			}
		}
		else flag=1;
		if(flag==0)
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}
int main()
{int n;
 scanf("%d\n",&n);
 char a[100][100];void sort (char *a);
 int i;
 {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')))  sort(a[i]);
  else printf("0\n");
 }
    }    
void sort (char *a)
{int i;int m=0;int n=0;
 for(i=0;*(a+i)!='\0';i++)
 {{if((*(a+i)=='_')||((*(a+i)>='a')&&(*(a+i)<='z'))||((*(a+i)>='A')&&(*(a+i)<='Z'))||((*(a+i)>='0')&&(*(a+i)<='9'))) m++;}n++;}
 if(m==n) printf("1\n");
 else if (m!=n) printf("0\n");
     }
int main()
{
	char sz[81],*p;
	int n,i,m,right;
	scanf("%d",&n);
	getchar();
	for(i=1;i<=n;i++){
		gets(sz);
		m=strlen(sz);
		p=sz;
		right=0;
		if(*p=='_'||(*p>='A'&&*p<='Z')||(*p>='a'&&*p<='z')){
			for(p=sz;p<sz+m;p++){
				if(*p=='_'||(*p>='A'&&*p<='Z')||(*p>='a'&&*p<='z')||(*p>='0'&&*p<='9')){
					right++;
				}
			}
			if(right==m){
				printf("1\n");
			}else{
				printf("0\n");
			}
		}else printf("0\n");
	}
	return 0;
}
int main()
{
	int n,len,i,j,flag;
	char s[81];
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(s,81);
		len=strlen(s);
		if(s[0]=='_'||s[0]>64&&s[0]<91||s[0]>96&&s[0]<96+27)
		{
			flag=1;
			for(j=1;j<len;j++)
				if(!(s[j]=='_'||s[j]>64&&s[j]<91||s[j]>96&&s[j]<96+27||s[j]>47&&s[j]<58))
				{
					flag=0;
					break;
				}
			if(flag)cout<<1<<endl;
			else cout<<0<<endl;
	
		}
		else cout<<0<<endl;
	}
	return 0;
}
int main()
{
    int i,j,n,x=1;
    scanf("%d",&n);
    getchar();
    char s[n][80];
    for(i=0;i<n;i++)
    {
                    x=1;
                    gets(s[i]);
                    if((s[i][0]>='a'&&s[i][0]<='z')||(s[i][0]>='A'&&s[i][0]<='Z')||s[i][0]=='_')
                    {
                               for (j=1;j<strlen(s[i]);j++)
                               if((s[i][j]>='a'&&s[i][j]<='z')||(s[i][j]>='A'&&s[i][j]<='Z')||s[i][j]=='_'||(s[i][j]>='0'&&s[i][j]<='9'))
                                         x=1;
                               else
                               {
                                   x=0;
                                   break;
                               }
                    }
                    else
                    {
                        x=0;
                    
                    }
                    printf("%d\n",x);
    }
}