Legal identifier of C Language

Source: Internet
Author: User

Legal identifier of C Language

 

Legal identifier of C Language Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 44597 Accepted Submission (s): 17933



Problem Description input a string to determine whether it is a legal identifier of C.

The Input data contains multiple test instances. The first line of the data is an integer n, indicating the number of test instances, followed by n rows of Input data, each line is a string of no more than 50 characters.

Output outputs a row of input data for each group. If the input data is a valid identifier of C, "yes" is output; otherwise, "no" is output ".

Sample Input
312ajffi8x_aff  ai_2

Sample Output
noyesno

 

# Include

# Include
Main ()
{Int a, I, j, B;
Char s [100];
Scanf ("% d", & B );
Getchar ();
While (B --)
{A = 1;
Gets (s );
If (s [0] <'A' & s [0]> 'Z') & (s [0]! = '_') | S [0] <'A' | s [0]> 'Z ')
{
Printf ("no \ n ");
Continue;
}
J = strlen (s );
For (I = 1; I If (s [I]> = 'A' & s [I] <= 'Z ') | (s [I]> = '0' & s [I] <= '9 ') | (s [I]> = 'A' & s [I] <= 'Z') | (s [I] = '_'))
A ++;
If (a = j)
Printf ("yes \ n ");
Else
Printf ("no \ n ");
}
Return 0;

}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.