3 12ajf fi8x_a ff ai_2
no yesno
import java.util.*; class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); while(n-->0 ){ String str=sc.nextLine(); if((str.charAt(0)>='a'&&str.charAt(0)<='z')||(str.charAt(0)>='A'&&str.charAt(0)<='Z')||(str.charAt(0)=='_')){ int k=0; for(int i=1;i<str.length();i++){ if((str.charAt(i)>='a'&&str.charAt(i)<='z')||(str.charAt(i)>='A'&&str.charAt(i)<='Z')||(str.charAt(i)>='0'&&str.charAt(i)<='9')||(str.charAt(i)=='_')) k++; } if(k==(str.length()-1)){ System.out.println("yes"); }else{ System.out.println("no"); } }else{ System.out.println("no"); } } } }
Scanner sc1=new Scanner(System.in); Scanner sc2=new Scanner(System.in); while(sc1.hasNext()){ int n=sc1.nextInt(); while(n-->0 ){ String str=sc2.nextLine();
........
原文地址:http://blog.csdn.net/u011479875/article/details/44982445