Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 64638 Accepted Submission(s):
35369
import java.util.*; class Main{ public static void main(String args[]) {Scanner cin=new Scanner(System.in); int n=cin.nextInt(); while(n-->0) {String sr=cin.next(); char []s=sr.toCharArray(); int sum=0; for(int i=0;i<s.length;i++) {if(s[i]>=‘0‘&&s[i]<=‘9‘) {sum++; } } System.out.println(sum); } } }
怎样把字符串转化成字符数组使用toCharArray进行转化;
原文:http://www.cnblogs.com/1314wamm/p/5296300.html