semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*
 * h056_panduan_biaoshifu.cpp
 * name:?????C????????
 *  Created on: 2011-12-2
 *      Author: zhujile
 */
int main(){
	int n;
	char a[81],*p;   //?????a??
	cin>>n;          //??????
	getchar();       //?????
	while(n--)       //??n???
	{
		cin.getline(a,81);              //??????
		p=a;                            //??????
		if (*p!='_'&&(*p>'z'||*p<'a')&&(*p>'Z'||*p<'A')) //???????????
		{
			cout<<'0'<<endl;            //???????0
			continue;                   //????
		}
		for (p=a+1;*p!='\0';p++)        //??'\0'??
		{
			if (*p!='_'&&(*p>'z'||*p<'a')&&(*p>'9'||*p<'0')&&(*p>'Z'||*p<'A')) //??????????????
			{
				cout<<'0'<<endl;        //???????0
				break;                  //????
			}
		}
		if (*p=='\0')                   //?????????
			cout<<'1'<<endl;            //??1
	}
	return 0;
}
int main()
{
	int n,i,flag;
	char str[81], *p;
	
	scanf("%d\n",&n);
    
	i=0;
	while (i<n)
	{
		gets(str);
		p=str;
		flag=0;
		if (((*p>=65)&&(*p<=90)) || ((*p>=97)&&(*p<=122)) || (*p=='_'))
			flag=1;
		else
			flag=0;
		p++;
		while ((*p!='\0')&&(flag==1))
		{
			if (((*p>=48)&&(*p<=57))||((*p>=65)&&(*p<=90))||((*p>=97)&&(*p<=122))|| (*p=='_')) flag=1;
			else flag=0;	
			p++;
		}
		printf("%d\n",flag);
		i++;
	
	}
	return(0);
}
int main ()
{
	int i,j,n,len;
	char s[81];
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		int flag=0;
		gets(s);
        len=strlen(s);
		for(j=0;j<len;j++)
		{
			if(j==0)
			{
			   if(s[j]=='_'||(s[j]>='A'&&s[j]<='Z')||(s[j]>='a'&&s[j]<='z'))
			      flag=1;
               else
		   	   {
               	   printf("%d\n",flag);
               	   break;
               }
			}
            else
			 {
			     if(s[j]=='_'||(s[j]>='A'&&s[j]<='Z')||(s[j]>='a'&&s[j]<='z')||(s[j]>='0'&&s[j]<='9'))
                 flag=1;
				 else
			 	 {
 					flag=0;
 					printf("%d\n",flag);
 					break;
 				 }			     	   
			 }
		 if(j==len-1)
           printf("%d\n",flag);
		}
	}
}
int main()
{
	
	int n,i,j,na=0,t0=1,t=1;	
	char a[81];
	cin >>n;
	cin.get();
	int a0;
	for(i=1;i<=n;i++)
	{
		cin.getline(a,81,'\n');	
		a0=(int)a[0];
		for(j=0;j<=80;j++)
		{
			if(a[j]=='\0')
			{
				na=j;
				break;
			}
		}
		
		if(a[0]!='_' && ((a0>122)||(a0<65)))
		{
			t0=0;
		}
		if(a[0]=='_' || ((a0>=65)&&(a0<=90)) || ((a0>=97)&&(a0<=122)))
		{
			t0=1;
		}
		if(na==1 && t0==0)
		{
			t=0;
		}
		if(na==1 && t0==1)
		{
			t=1;
		}
		if(na>1 && t0==0)
		{
			t=0;
		}
		if(na>1 && t0==1)
		{
			for(j=1;j<na;j++)
			{
				int aj;
				aj=(int)a[j];
				if(aj==95 || (aj>=48 && aj<=57) || (aj>=65 && aj<=90) || (aj>=97 && aj<=122) )
				{
					t=1;
				}
				else 
				{
					t=0;
					break;
				}
			}
		}
		cout <<t << endl;
	}
	return 0;
}
main()
  {
        int i,j,n;
        char str[1000];
        scanf("%d\n",&n);
        for(i=0;i<n;i++)
        {gets(str);
        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'&&j>0)))
        break;
        }
        if(str[j])
        printf("0\n");
        else
        printf("1\n");}
        getchar();
        getchar();
        }
int pdshuzi(char zi)
{
    int zhi1;
	if(zi>='0'&&zi<='9')zhi1=1;
	else zhi1=0;
	return(zhi1);
}

int pdzimu(char zi)
{
	int zhi2;
	if((zi>='a'&&zi<='z')||(zi>='A'&&zi<='Z'))zhi2=1;
	  else zhi2=0;
	  return(zhi2);
}

int sort(char *head)
{
	char *t;
	int zhi,flag=1;
	t=head;
	if(pdzimu(*t)==1||*t=='_')zhi=1;
	else {zhi=0;return(zhi);}
 
	t++;
	for(;*t!='\0';t++)
	{if(pdzimu(*t)==1||pdshuzi(*t)==1||*t=='_')flag=1;
		  else flag=0;
		  if(flag==0){return(0);break;}}
	if(flag==1)return(1);

}

void main()
{
  char *name[100];
  char **p;
  int n,i;

  scanf("%d\n",&n);
  for(p=name,i=0;i<n;i++,p++)
	  *p=(char *)malloc(90*sizeof(char));

  for(p=name;p<name+n;p++)
	  gets(*p);

  for(p=name;p<name+n;p++)
	  printf("%d\n",sort(*p));
}
int main()
{
    int n,k;
    char c[100];
    scanf("%d\n",&n);
    for(int i=1;i<=n;i++)
    {
        k=1;
        gets(c);
        for (int j=0;c[j]!='\0';j++)
        {
            if ((j==0)&&(c[j]<='9')&&(c[j]>='0'))
            {
                k=0;
                break;
            }
            else if ((c[j]<='z')&&(c[j]>='a')) continue;
            else if ((c[j]<='Z')&&(c[j]>='A')) continue;
            else if ((c[j]<='9')&&(c[j]>='0')) continue;
            else if (c[j]=='_') continue;
            else
            {
                k=0;
                break;
            }
        }
        printf("%d\n",k);
    }
    return 0;
}
int panduan(char a){
	int result=0;
	if((a>='a'&&a<='z')||(a>='A'&&a<='Z')||(a>='0'&&a<='9')||(a=='_'))
		 result=1;
	return result;
}
int first(char b){
	int result=0;
	if((b>='a'&&b<='z')||(b>='A'&&b<='Z')||(b=='_'))
		result=1;
	return result;
}
int main(int argc, char* argv[])
{
	int i,n,j,len,flag;
	int panduan(char a);
	int first(char b);
	char s[81];
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		gets(s);
		len=strlen(s);
		flag=1;
		if(first(s[0])==0)
			flag=0;
		else if(first(s[0])==1){	
			for(j=1;j<len;j++){
				if(panduan(s[j])==0){
				flag=0;
				break;
				}
			}
		}
		if(flag==1){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
	}
	return 0;
}
/*
 * 1.cpp
 *
 *  Created on: 2010-12-19
 *      Author: hanzhe
 */


int main(){//????
	int n,i;
	char none[100];//????
	cin>>n;
	cin.getline(none,100);//???????
	while(n>0){
		char a[81];
		int g=0;//???
		cin.getline(a,81);
		int na=strlen(a);//????
		if(((a[0]=='_')+(((a[0]-'a')>=0)&&((a[0]-'z')<=0))+(((a[0]-'A')>=0)&&((a[0]-'Z')<=0)))==1)
			g=1;//?????
		for(i=1;i<na;i++)//????
			if(((a[i]=='_')+(((a[i]-'a')>=0)&&((a[i]-'a')<=25))+
					(((a[i]-'0')>=0)&&((a[i]-'0')<=9))+(((a[i]-'A')>=0)&&((a[i]-'A')<=25)))==1)
				g=g*1;
			else g=g*0;
		cout<<g<<endl;
		n--;
	}
	return 0;
}//????
int main()
{
   int n,i,len,j,k,num=0;
   char str[81];
   cin>>n;
   cin.get();
   for(i=0;i<n;i++)
        {
           num=0;
           gets(str);
           if((str[0]!='_') && ((str[0]>'Z' && str[0]<'a') || (str[0]>'z') || (str[0]<'A')))     { 
                 cout<<0<<endl;
                 continue;
                   }
           len=strlen(str);
           if(len==1) cout<<1<<endl;
           
           else{
                 for(j=1;j<len;j++)
                    {
                       if((str[j]>='0'&& str[j]<='9') 
						   || ((str[j]>='A' && str[j]<='Z') 
						   || (str[j]>='a' && str[j]<='z')) 
						   || str[j]=='_')
                       num++;
                     }
                  if(num==len - 1) k=1;
                  else k=0;
                  cout<<k<<endl;
               }
        }
    return 0;
}
void main()
{
	char str[100][81];
	int n,i,j;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
		gets(str[i]);
	for(i=0;i<n;i++)
	{
		if(**(str+i)>=65&&**(str+i)<=90||**(str+i)>=97&&**(str+i)<=122||**(str+i)==95)
		{
			for(j=1;str[i][j]!='\0';j++)
			{
				if(*(*(str+i)+j)>=65&&*(*(str+i)+j)<=90||*(*(str+i)+j)>=97&&*(*(str+i)+j)<=122||*(*(str+i)+j)>=48&&*(*(str+i)+j)<=57||*(*(str+i)+j)==95);
				else break;
			}
			if(str[i][j]!='\0')printf("0");
		    else printf("1");
		}
		else printf("0");
		printf("\n");
	}
}
int main()
{
	int n,i,j;
	char a[200][81];
	cin>>n;
	for(i=0;i<=n;i++)
		cin.getline(a[i],81);
	for(i=1;i<=n;i++)
	{
		if(a[i][0]=='_'||((int)a[i][0]>=65&&(int)a[i][0]<=122))
		{j=1;
			while(a[i][j]!='\0')
			{
				if(((int)a[i][j]>=65&&(int)a[i][j]<=122)||((int)a[i][j]>=48&&(int)a[i][j]<=57)||a[i][j]=='_')
					j++;
				else {cout<<0<<endl;break;}
			}
			if(a[i][j]=='\0')
				cout<<1<<endl;
		}
		else cout<<0<<endl;
	}
	return 0;
}
int main()
{
    int n = 0 ;
    cin >> n ;
    int i = 0 ;
    char ch[100][100] ;
    for( i = 0 ; i <= n - 1 ; i ++ )
    {
         while( cin.get() != '\n');
         cin.get( ch[i] , 100 , '\n' ) ;
    }
    for( i = 0 ; i <= n - 1 ; i ++ )
    {
         if( ch[i][0] == 95 || ( ch[i][0] >= 65 && ch[i][0] <= 90 ) || ( ch[i][0] >= 97 && ch[i][0] <= 122 ) )
         {
         int j = 0 ;
         int counter = 0 ;
         int m = strlen( ch[i] ) ;
         for( j = 0 ; j <= m - 1 ; j ++ )
         {
              if( ch[i][j] == 95 || ( ch[i][j] >= 65 && ch[i][j] <= 90 ) || ( ch[i][j] >= 97 && ch[i][j] <= 122 ) || ( ch[i][j] >= 48 && ch[i][j] <= 57 ) ) 
              counter = counter ;
              else
              counter ++ ;
         }
         if( counter == 0 )
         cout << 1 << endl ;
         else
         cout << 0 << endl ;
         }
         else
         cout << 0 << endl ;
    }
return 0;
}
int identf(char *str);
int isKey(char *str);
int x_strcmp(char *si, char *di);

int main()
{
 char buffer[256];
 int n,i;
 scanf("%d",&n);
 gets(buffer);
 for (i=0;i<n;i++){
 gets(buffer);
 if(identf(buffer))
  puts("1");
 else
  puts("0");
 }  
 return 0;
}
int identf(char *str)
{
 int flag=0;
 char *p=str;
 if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_')
 {
  flag=1;
  str++;
 }
 while(*str && flag)
 {
  if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_'
   || (*str>='0' && *str<='9'))
  {
   flag=1;
   str++;
  }
  else
   flag=0;
 }
 if(flag)
  flag=isKey(p);
 return flag;
}
int isKey(char *str)
{
 char *keyword[]={"auto", "break", "case", "char", "const", "continue", "default",
     "do", "double", "else", "enum", "extern", "float", "for", "goto",
     "if", "int", "long", "register", "return", "short", "signed", 
     "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned",
     "void", "volatile", "while"};
 int i, flag=1;

 for(i=0; i<32; i++)
 {
  if(x_strcmp(str, keyword[i])==0)
  {
   flag=0;
   break;
  }
 }

 return flag;
}
int x_strcmp(char *si, char *di)
{
 while(*si && *di && *si==*di)
 {
  si++;
  di++;
 }
 return *si-*di;
}
int main()
{
	int n,i,j,k,m;
	cin>>n;
	char a[n][81];
	cin.getline(a[0],81);
	for (i=0;i<n;i++)
		cin.getline(a[i],81);
	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'))
		{
			k=strlen(a[i]);
			for (j=1;j<k;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'))    m=0;
				else     {cout<<'0'<<endl; break;}
			}
			if (j==k) cout<<'1'<<endl;
		}
		else cout<<'0'<<endl;
	}
	return 0;
}
int main()
{
    int n,i,j,k,flag=1;
    char str[81],num[15],*ptr;
    gets(num);n=atoi(num);
    for(i=0;i<n;i++){
                     flag=1; 
                     gets(str);ptr=str;
                     if(*ptr!='_' &&(*ptr>90 || *ptr<65)&&(*ptr>122 || *ptr<97)){
                                  printf("0\n");
                                  flag=0;
                     }else{
                           for(ptr=str+1;*ptr !='\0';ptr++){
                                                    if(*ptr!='_' && 
                                                    (*ptr>57 || *ptr<48)&&
                                                    (*ptr>90 || *ptr<65)&&
                                                    (*ptr>122 || *ptr<97)){
                                                    printf("0\n");
                                                    flag=0;
                                                    break;}
                                                    }
                           } 
                     if(flag) printf("1\n");
                     }
    return 0;
}
int main()//?????
{//?????
	char str[100][100];//??????
	int n,i,j,num;//????
	cin>>n;//??n
	cin.get();//??????
	for(i=0;i<n;i++)cin.getline(str[i],100);//??????
	for(i=0;i<n;i++)//????
	{num=0;//????????num??
		for(j=0;j<strlen(str[i]);j++)//????
		{
			if((str[i][j]>='0'&&str[i][j]<='9')||(str[i][j]>=65&&str[i][j]<=90)||(str[i][j]>=97&&str[i][j]<=122)||str[i][j]=='_')num++;//??????????????????????num??
			else {cout<<0<<endl;break;}//??????0?????
		}
		if(num==strlen(str[i]))//?num????????
		{
			if(str[i][0]=='_'||(str[i][0]>=65&&str[i][0]<=90)||(str[i][0]>=97&&str[i][0]<=122)){cout<<1<<endl;continue;}//??????????????????????1?????
			else  {cout<<0<<endl;continue;}//??????0?????
		}
	}
	return 0;//????????????????????
}//?????
int main()
{
	int n,i,l,s,j,k=1,p=1;
	cin>>n;
	cin.get();
	char c[90];
	for(i=0;i<n;i++)
	{
		k=1;p=1;
		cin.getline(c,90);
		l=strlen(c);
		s=c[0];
		if (!((s>=97&&s<=122)||(s<=90&&s>=65)||c[0]=='_'))
			cout<<"0"<<endl;
		else
		{
			for(j=1;j<l;j++)
			{
				if(!((c[j]>='0'&&c[j]<='9')||(c[j]>='a'&&c[j]<='z')||(c[j]>='A'&&c[j]<='Z')||c[j]=='_'))
				{
					cout<<"0"<<endl;
					p=0;break;
				}
			}
			if (p==1)
				cout<<"1"<<endl;
		}
	}
			return 0;
}
int main()
{
	int n;
	int i, j;
	int yesOrNo;
	char * p;
	
	scanf("%d",&n);
	getchar();
	for (i = 0; i < n; i++) {
		char a[81] = {'\0'};
		gets(a);
		p = a;
		yesOrNo = 0;
		if (*p == '_' || (*p >='A' && *p <= 'Z') || (*p>='a' && *p <= 'z')) {
			for (j = 0; j < strlen(a); j++) {
				if ((*p >='A' && *p <= 'Z') || (*p>='a' && *p <= 'z') || (*p >= '0' && *p <= '9') || *p == '_') {
					p++;
				}
				else {
					printf("0\n");
					yesOrNo = 1;
					break;
				}
			}
			if (yesOrNo == 0) {
				printf("1\n");
			}
		}
		else {
			printf("0\n");
		}
	}
	return 0;
}
int avoid(char as[]);
int main()
{
	int n, i, num;
	char str[10000][81];
	cin >> n;
	cin.get();
	for( i = 0; i < n; i ++ )
	{
		cin.getline(str[i], 81);
		if( str[i][0] == '_' )
		{
			num = avoid(str[i]);
			cout << num << endl;
		}
		if( str[i][0] != '_' )
		{
			if((str[i][0] - 'a' >= 0 && str[i][0] - 'a' <= 25) ||
			   (str[i][0] - 'A' >= 0 && str[i][0] - 'A' <= 25) )
			{
				num = avoid(str[i]);
				cout << num << endl;
			}
			else
				cout << 0 << endl;
		}
	}
	return 0;
}
int avoid( char as[] )
{
	int len; 
	len = strlen(as);
    int j, t;
    for( j = 1; j < len; j ++ )
	{
		if((as[j] - 'a' < 0 || as[j] - 'a' > 25) &&
	       (as[j] - 'A' < 0 || as[j] - 'A' > 25) && 
	       (as[j] - '0' < 0 || as[j] - '0' > 9 ) &&
	       (as[j] != '_') )
		{
			t = 0;
			break;
		}
	}
    if( j == len )
         t = 1;
    return (t);
}
int judge(char a[100])
{
	int j,p=1,l;
    l=strlen(a);
	if(!((a[0]>='a'&&a[0]<='z')||(a[0]>='A'&&a[0]<='Z')||(a[0]=='_')))
		return 0;
	else
	{
		for(j=1;j<l;j++)
		{
			if (!((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='Z')||(a[j]=='_')||(a[j]>='0'&&a[j]<='9')))
			{
				p=0;
				return 0;
			}
		}
			if (p==1)
				return 1;
	}
}
int main()
{
	int n,i,r;
	char a[100];
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
		cin.getline(a,100);
		r=judge(a);
		cout<<r<<endl;
	}
	return 0;
}
int identf(char *str);
int isKey(char *str);


int main()
{

 int n,i;
 char buffer[256];
scanf("%d",&n);
getchar();
 for(i=0;i<n;i++)
 {
	gets(buffer);
	if(identf(buffer))
		 {
	printf("1\n");
		}
	else
	{
		printf("0\n");
	}
 }
 return 0;
}






/**************************************************************************/
int identf(char *str)
{
 int flag=0;
char *p=str;
 /*???????????*/
 if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_')
 {
  flag=1;
  str++;
 }
 /*????????????*/
 while(*str&&flag)
 {
  if((*str>='a' && *str<='z') || (*str>='A' && *str<='Z') || *str=='_'
   || (*str>='0' && *str<='9'))
  {
   flag=1;
   str++;
  }
  else
   flag=0;
 }
 
 /*????????*/
 if(flag)
  flag=isKey(p);

 return flag;
}
/*****************************??????*******************************/
int isKey(char *str)
{
 char *keyword[]={"auto", "break", "case", "char", "const", "continue", "default",
     "do", "double", "else", "enum", "extern", "float", "for", "goto",
     "if", "int", "long", "register", "return", "short", "signed", 
     "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned",
     "void", "volatile", "while"};
 int i, flag=1;

 for(i=0; i<32; i++)
 {
  if(strcmp(str, keyword[i])==0)
  {
   flag=0;
   break;
  }
 }

 return flag;
}
int main()
{
	int n,i,j,m,k;
	char q[100];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		gets(q);                                 //??????????????????
	    m=strlen(q);
		if((q[0]<'A' || (q[0]>'Z'&& q[0]<'a')|| q[0]>'z')&&q[0]!=95) printf("0\n");
		else if(m==1) printf("1\n");
		else
		{
			for(k=1;k<=m-1;k++)
			 {
				 if((q[k]>=48 && q[k]<=57 )|| (q[k]>=65 && q[k]<=90)|| (q[k]>=97 && q[k]<=122)||q[k]==95) ;
				 else
				 {
					 printf("0\n");
					 break;
				  }
				 if (k==m-1) printf("1\n");
			 }
		}
	}
	return 0;
}
int main(){
  int k;
  char ch,s[100];
  scanf("%d\n",&k);
  for (;k;k--){
    scanf("%c",&ch);
    if ((ch>47)&&(ch<58)){
      while (ch!='\n') scanf("%c",&ch);
      printf("0\n");
    }
    else{
      while (ch!='\n'){
        if ((ch!='_')&&((ch<48)||((ch>57)&&(ch<65))||((ch>90)&&(ch<97))||(ch>122))){
          while (ch!='\n') scanf("%c",&ch);
          ch=' ';
          printf("0\n");
          break;
        }
        scanf("%c",&ch);
      }
      if (ch=='\n')
        printf("1\n");
    }
  }
}
int main()
{
    int n,i,j,k,m,sum,h;
    char c[100];char a[0];
    
    gets(a);
    n=atoi(a);
    for(i=1;i<=n;i++)
    {    
         for(h=0;h<100;h++)
         c[h]=0;
         
         sum=0;
     gets(c);
        k=strlen(c);
      
   if(c[0]!='_'&&(c[0]<65||c[0]>122||(c[0]>90&&c[0]<97)))
                        {printf("0\n");}
                      
                    else
                    {for(j=1;j<k;j++)
                    {
                                       if((c[j]>47&&c[j]<58)||(c[j]>64&&c[j]<91)||(c[j]>96&&c[j]<123)||c[j]=='_')
                                       sum=sum+1;
                                       else
                                       break;
                                       }
                                        if(sum==k-1) 
                                        printf("1\n");      
                                        else
                                        printf("0\n");
                                        }  }getchar();getchar();getchar();getchar();}
int main(){
    int n,m=1,i,j,c;
    char a[100];
    cin>>n;
    cin.getline(a,95);
    while(m<=n){
    	j=0;
    	cin.getline(a,95);
    	c=strlen(a);
    	if((a[0]>='a'&&a[0]<='z')||(a[0]=='_')||(a[0]>='A'&&a[0]<='Z')){
    		if(c==1)cout<<1<<endl;
    	for(i=1;i<c;i++){
    	if((a[i]>='a'&&a[i]<='z')||(a[i]=='_')||(a[i]>='A'&&a[i]<='Z')||(a[i]>='0'&&a[i]<='9')||a[i]=='_'){
    		j++;
    	}

    	else {
    		cout<<0<<endl;
    		break;
    	}
    	if(j==(c-1))cout<<1<<endl;
    	}
    	}
    	else cout<<0<<endl;

    	m++;
    }
	return 0;
}
/*
 * 1000062703_30.cpp
 *
 *  Created on: 2010-9-26
 *      Author: ??
 */
int main(){
	int n,i,flag;
	cin>>n;
	cin.get();
	while(n>0){
		char z[81];
		cin.getline(z,81);
		flag=1;
		    if(z[0]=='_'||(z[0]>='a'&&z[0]<='z')||(z[0]>='A'&&z[0]<='Z')){
			    for(i=1;i<strlen(z);i++){
				    if((z[i]!=' ')&&!(z[i]>='!'&&z[i]<'0')&&(z[i]='_'||(z[i]>='a'&&z[i]<='z')||(z[i]>='A'&&z[i]<='Z')||(z[i]>='0'&&z[i]<='9')))
					    continue;
				    flag=0;
			}
			    if(flag) cout<<1<<endl;
			    else cout<<0<<endl;
		}
		    else cout<<0<<endl;
		    n--;
	}
	return 0;
}
int main()
{
	int n,i;
	cin>>n;
	cin.get();
	for(i=0;i<n;i++)
	{
        int j, n1;
        char a[81];
		memset(a,0,81);
		cin.getline(a,81);
	    n1=strlen(a);
		if(n1==1)
		{
			if((a[0]>='A'&&a[0]<='z')||a[0]=='_')
			{
				cout<<"1"<<endl;
			}
			else
			{
				cout<<"0"<<endl;
			}
		}
		else
		{
			if((a[0]>='A'&&a[0]<='z')||a[0]=='_')
			{
			    for(j=1;a[j]!='\0';j++)
				{
				  if((a[j]>='0'&&a[j]<='9')||(a[j]>='A'&&a[j]<='z')||a[j]=='_')
				  {
				      continue;
				  }
				    break;
				}
			    if(j<n1)
				{
				  cout<<"0"<<endl;
				}
			    if(j==n1)
				{
				cout<<"1"<<endl;
				}
			}
		    else
			{
		       cout<<0<<endl;
			}
		}
		 

	    
	
	}
	return 0;
}
int main()
{
	int n , i , j , k;
	char c[85], t;
	cin >> n;
	t = cin.get();
	for (i = 1; i <= n; i++)
	{
		j = 0;
	    c[0] = cin.get();
		while( (c[j] - '\n') != 0)
		{
			j++;
			c[j] = cin.get();
		}
		if ( c[0] != '_' && c[0] != 'a' && c[0] != 'b' && c[0] != 'c' && c[0] != 'd' && c[0] != 'e' && 
			c[0] != 'f' && c[0] != 'g' && c[0] != 'h' && c[0] != 'i' && c[0] != 'j' && c[0] != 'k' && c[0] != 'l' && 
			c[0] != 'm' && c[0] != 'n' && c[0] != 'o' && c[0] != 'p' && c[0] != 'q' && c[0] != 'r' && c[0] != 's' && 
			c[0] != 't' && c[0] != 'u' && c[0] != 'v' && c[0] != 'w' && c[0] != 'x' && c[0] != 'y' && c[0] != 'z' && 
			c[0] != 'A' && c[0] != 'B' && c[0] != 'C' && c[0] != 'D' && c[0] != 'E' && c[0] != 'F' && c[0] != 'G' && 
			c[0] != 'H' && c[0] != 'I' && c[0] != 'J' && c[0] != 'K' && c[0] != 'L' && c[0] != 'M' && c[0] != 'N' &&
			c[0] != 'O' && c[0] != 'P' && c[0] != 'Q' && c[0] != 'R' && c[0] != 'S' && c[0] != 'T' && c[0] != 'U' && 
			c[0] != 'V' && c[0] != 'W' && c[0] != 'X' && c[0] != 'Y' && c[0] != 'Z' )
			cout << "0" << endl;
		else
		{
			for( k = 1; k < j; k++)
			{
				if(c[k] != '_' && c[k] != 'a' && c[k] != 'b' && c[k] != 'c' && c[k] != 'd' && c[k] != 'e' && 
			c[k] != 'f' && c[k] != 'g' && c[k] != 'h' && c[k] != 'i' && c[k] != 'j' && c[k] != 'k' && c[k] != 'l' && 
			c[k] != 'm' && c[k] != 'n' && c[k] != 'o' && c[k] != 'p' && c[k] != 'q' && c[k] != 'r' && c[k] != 's' && 
			c[k] != 't' && c[k] != 'u' && c[k] != 'v' && c[k] != 'w' && c[k] != 'x' && c[k] != 'y' && c[k] != 'z' && 
			c[k] != 'A' && c[k] != 'B' && c[k] != 'C' && c[k] != 'D' && c[k] != 'E' && c[k] != 'F' && c[k] != 'G' && 
			c[k] != 'H' && c[k] != 'I' && c[k] != 'J' && c[k] != 'K' && c[k] != 'L' && c[k] != 'M' && c[k] != 'N' &&
			c[k] != 'O' && c[k] != 'P' && c[k] != 'Q' && c[k] != 'R' && c[k] != 'S' && c[k] != 'T' && c[k] != 'U' && 
			c[k] != 'V' && c[k] != 'W' && c[k] != 'X' && c[k] != 'Y' && c[k] != 'Z' && c[k] != '0' && c[k] != '1' && 
			c[k] != '2' && c[k] != '3' && c[k] != '4' && c[k] != '5' && c[k] != '6' && c[k] != '7' && c[k] != '8' && 
			c[k] != '9' )
				{
					cout << "0" << endl;
					break;
				}
			}
			if (k == j)
				cout << "1" << endl;
		}
	}
         return 0;
}
int main()
{
	int n, i, j, len;
	char str[100][81];
	cin >> n;
	cin.get();
	for ( i = 0; i < n; i ++ )
	{
		cin.getline(str[i],81);
		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 ( j = 1; j < len; j ++)
			{
				if ((str[i][j] == '_') || ((str[i][j] >='a') && (str[i][j] <='z')) || ( (str[i][j] >= 'A') && (str[i][j] <='Z')) || ( (str[i][j] >= '0') && (str[i][j] <='9')))
					continue;
				else break;
			}
			if ( j == len ) 
				cout << "1" <<endl;
			else cout << "0" << endl;
		}
			else cout << "0" << endl;
	}
	return 0;
}
int main()
{
	int n;
	cin>>n;
	char a[2];
	cin.getline(a,1);
	for(int j=1;j<=n;j++)
	{
		char *p,word[100];
        cin.getline(word,100);
        p=word;
        int w=0;
		if(*p=='_'||(*p>=65&&*p<=90)||(*p>=97&&*p<=122))
		{
			while(*p!='\0')
			{
				if(*p=='_'||(*p>=65&&*p<=90)||(*p>=97&&*p<=122)||(*p>=48&&*p<=57))p++;
				else {
					cout<<0<<endl;w=1;
					break;
				     }
			}
			if(w==0)cout<<1<<endl;
		}
		else cout<<0<<endl;
	}
	return 0;
}
int main()
{
	char(*p)[81];
	int n;
	scanf("%d\n",&n);
	p=(char(*)[81])malloc(n*sizeof(char[81]));
	char (*head)[81];
	head=p;
	int i;
	for(i=0;i<n;i++)
	{
		gets(*p);
		p++;
	}
	p=head;
	for(i=0;i<n;i++)
	{
		if(**p=='_'||(**p>='a'&&**p<='z')||(**p>='A'&&**p<='Z'))
		{
			char *al=*p;
			while(*al!='\0')
			{
			   if(!((*al>='0'&&*al<='9')||(*al>='a'&&*al<='z')||(*al>='A'&&*al<='Z')||(*al=='_')))
			   {
				   printf("0\n");
				   break;
			   }
			   al++;
			}
			if (*al=='\0') printf("1\n");
		}
		else
			printf("0\n");
		p++;
	}
	return 0;
}
int main()
{
    int i, j, n, l, flag;
    cin >> n;
    cin.get();
    for ( i = 1; i <= n; i++ )
    {
        flag = 1;
        char str[81];
        cin.getline ( str, 81 );
        if ( !(str[0] >= 'A' && str[0] <= 'z') && ( str[0] != '_' ) )
           flag = 0;
        l = strlen(str);
        if ( flag )
        {
             for ( j = 0; j < l;j++ )
             {
                 if ( str[j] >= 'A' && str[j] <= 'z' )
                    flag = 1;
                 else if ( str[j] >= '0' && str[j] <= '9' )
                         flag = 1;
                      else if ( str[j] == '_' )
                              flag = 1;
                           else
                           {
                               flag = 0;
                               break;
                           }
             }
        }
        cout << flag << endl;
    }
    return 0;
}