/**

 * C语言合法标识符

 */

import java.util.*;

public class acm2024 {



public static void main(String[] args) {

Scanner in = new Scanner(System.in);

int n = in.nextInt();

in.nextLine();

while (n--!= 0) {

String str = in.nextLine();

char[] chs = str.toCharArray();

//Character.isLetter(chs[0])确定指定字符是否为字母

if (!(Character.isLetter(chs[0]) || chs[0] == '_')) {

System.out.println("no");

continue;

}

boolean flag = true;

for (int i = 1; i < chs.length; i++) {

//Character.isDigit(chs[i])确定指定字符是否为数字
Character.isLetter(chs[i])确定指定字符是否为字母

if (!(Character.isDigit(chs[i]) || Character.isLetter(chs[i]) || chs[i] == '_')) {

flag = false;

break;

}

}

if(flag)

System.out.println("yes");

else

System.out.println("no");

}

}

}

acm2024的更多相关文章

随机推荐

  1. SpringMVC 方法参数设置

    /** 在方法中配置参数: (1) 内置对象配置: request:获取cookie.请求头... 获取项目根路径 request.getContextPath() response:用于ajax的输 ...

  2. Linux命令service - 系统服务管理(转)

    用途说明 service命令用于对系统服务进行管理,比如启动(start).停止(stop).重启(restart).查看状态(status)等.相关的命令还包括chkconfig.ntsysv等,c ...

  3. Tasker to answer incoming call by pressing power button

    nowadays, the smartphone is getting bigger in size, eg. samsung galaxy note and note 2, sorta big in ...

  4. Red Hat Enterprise Linux 7.4上安装Oracle 11.2.0.4

    1. 配置Yum源及关闭SeLinux [root@localhost ~]# mkdir /media/rhel [root@localhost ~]# mount /dev/cdrom /medi ...

  5. Linux内核相关常见面试题

      转:http://www.embeddedlinux.org.cn/html/xinshourumen/201303/11-2475.html   本文详细阐述了linux内核相关的开发职位面试中 ...

  6. datagrid在MVC中的运用07-实现Master-Detail(使用PartialView)

    本文主要体验用jQuery Easyui的datagrid来实现Master-Detail主次表.谢谢Kevin的博文,助我打开了思路. 主表显示所有的Category,当点击主表的展开按钮,显示该C ...

  7. Rete算法

    RETE算法介绍一. rete概述Rete算法是一种前向规则快速匹配算法,其匹配速度与规则数目无关.Rete是拉丁文,对应英文是net,也就是网络.Rete算法通过形成一个rete网络进行模式匹配,利 ...

  8. N-Queens II leetcode java

    题目: Follow up for N-Queens problem. Now, instead outputting board configurations, return the total n ...

  9. Valid Parentheses leetcode java

    题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the ...

  10. 检测 USB 设备拨插的 C# 类库:USBClassLibrary

    这是采用C#开发的一个USB库,使您可以管理USB设备的连接和分离事件,探测自己的设备.可以运行在Windows XP和Windows7 64位系统下. 01 private void USBPort ...