//alphabet 英文字母 ,blank 空格,数字 digit#include <stdio.h>int main(){ char c; int alphabet=0,blank=0,digit=0,other=0; printf("请输入一行字符:\n ...
public static void main String args 输入一行字符,分别统计出其中英文字母 空格 数字和其它字符的个数。 String str ABab哈哈 , int letter 字母 int space 空格 int number 数字 int other 其他 for int i i lt str.length i char ch str.charAt i 从字符串中获取 ...
2018-08-11 12:36 0 995 推荐指数:
//alphabet 英文字母 ,blank 空格,数字 digit#include <stdio.h>int main(){ char c; int alphabet=0,blank=0,digit=0,other=0; printf("请输入一行字符:\n ...
public class CaculateCharCount { /** * @description 输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 * @param args */ public static void main(String ...
一、参考解法: 1 2 ...
题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 程序分析:利用while语句,条件为输入的字符不为 '\n '. ...
Scanner.useDelimiter( )方法 由于Scanner对象将首先跳过输入流开头的所有空白分隔符,然后对输入流中的信息进行检查,直到遇到空白分隔符为止;因此输入数据:this is a test;空白后面的字符:is a test不会显示输出来 这时就需要 ...
一、参考解法: s =input('请输入字符串:') dic={'letter':0,'integer':0,'space':0,'other':0} for i in s: if i >'a' and i<'z' or i>'A' and i<'Z ...