http://acm.hdu.edu.cn/showproblem.php?pid=2024
Problem description Enter a string to determine whether it is a valid identifier for C. Input data contains multiple test instances, the first row of the data is an integer n, which indicates the number of test instances, followed by n rows of input data, each of which is a string of not more than 50 in length. Output outputs one row for each set of input data. If the input data is a valid identifier for C, output "yes", otherwise, output "no". Sample Input312ajffi8x_aff Ai_2 sample Outputnoyesno code:
#include <bits/stdc++.h>using namespace Std;char s[111];int len;int A () {    if (s[0]>= ' A ' &&s[0]< = ' Z ' | | s[0]>= ' A ' &&s[0]<= ' Z ' | | s[0]== ' _ ')        return 1;    else        return 0;} int B () {for    (int i=1; i<len; i++)    {        if (s[i]>= ' a ' &&s[i]<= ' Z ' | | s[i]>= ' A ' &&s[i]<= ' Z ' | | s[i]== ' _ ' | |           s[i]>= ' 0 ' &&s[i]<= ' 9 ')            continue;        else            return 0;    }    return 1;} int main () {    int n;    cin>>n;    GetChar ();    int sum=1;    for (int i=1; i<=n; i++)    {        gets (s);        printf ("!!! %s\n ", s);        Len = strlen (s);        Sum=a () *b ();        Cout<<a () << "<<b" () <<endl;        if (sum==1&&len<=50)            cout<< "yes" <<endl;        else            cout<< "no" <<endl;    }    return 0;}
  
HDU 2024 C language legal identifiers