import java.util.Scanner;
public class count_char
{
public static void main(String args[])
{
int count1=0,count2=0,count3=0,count4=0;
String str;
Scanner reader = new Scanner(System.in); while((str=reader.nextLine())!=null)
{
char temp[]=str.toCharArray();
for(int i=0; i<temp.length; i++)
{
if(Character.isLetter(temp[i])) count1++;
else if (Character.isDigit(temp[i])) count2++;
else if (Character.isWhitespace(temp[i])) count3++;
else count4++;
}
System.out.printf("letter:%d number:%d Whitespace:%d another:%d \n"
, count1, count2, count3, count4);
str="";
}
}
}

count_char的更多相关文章

  1. 【转】shell脚本处理字符串的常用方法

    转自:http://blog.csdn.net/linfeng999/article/details/6661233 1. 构造字符串 直接构造 STR_ZERO=hello #shell中等号左右的 ...

  2. Shell中的正则表达式及字符串处理

    shell里一个正则表达式就是由普通字符(例如字符 a 到 z)以及特殊字符(称为元字符)组成的文字模式.该模式描述在查找文字主体时待匹配的一个或多个字符串.正则表达式作为一个模板,将某个字符模式与所 ...

  3. Python学习入门基础教程(learning Python)--6.4 Python的list与函数

    list是python下的一种数据类型,他和其他类型如整形.浮点型.字符串等数据类型一样也可作为函数的型参和实参来使用! 1.list作为参数 list数据类型可以作为函数的参数传递给函数取做相应的处 ...

  4. 【转】shell字符串截取

    shell字符串的截取的问题: 一.Linux shell 截取字符变量的前8位,有方法如下: 1.expr substr “$a” 1 8 2.echo $a|awk ‘{print substr( ...

  5. 震惊!!!源程序特征统计程序——基于python getopt库

    项目github地址:https://github.com/holidaysss/WC PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟 ...

  6. Implementation of WC in JAVA

    Implementation of WC in JAVA github地址 相关要求 基本功能 -c [文件名] 返回文件的字符数 (实现) -w [文件名] 返回文件的词的数目 (实现) -l [文 ...

  7. poj1521

    霍夫曼编码,建树 #include <cstdio> #include <cstring> #include <queue> using namespace std ...

  8. Python学习手册之数据类型

    在上一篇文章中,我们介绍了 Python 的异常和文件,现在我们介绍 Python 中的数据类型. 查看上一篇文章请点击:https://www.cnblogs.com/dustman/p/99799 ...

  9. 常用shell脚本命令

    常用shell脚本命令 1.显示包含文字aaa的下一行的内容: sed -n '/aaa/{n;p;}' filename 2.删除当前行与下一行的内容: sed -i '/aaa/{N;d;}' f ...

随机推荐

  1. ORACLE_ALIAS

    Oracle / PLSQL: ALIASES website:https://www.techonthenet.com/oracle/alias.php This Oracle tutorial e ...

  2. 第二次团队Scrum

    长大一条龙之登录注册 一.设计详情 本次冲刺我们团队实现了长大一条龙的登录注册功能,我们的这个项目严格遵守MVC架构,采用前后端分离的策略.我们将登录注册分为二层,DAO层:负责与数据进行交互,读写数 ...

  3. 如何在Kubernetes里给PostgreSQL创建secret

    创建一个initdb.sql文件,输入如下内容: -- This is a postgres initialization script for the postgres container. -- ...

  4. C4C Cloud Application Studio做ABSL开发的一些性能方面的最佳实践

    Stefan Hagen在博文SAP Cloud Application Studio Performance Best Practices里介绍了在C4C里使用Cloud Application S ...

  5. Jmeter入门12 __time函数 jmeter获取当前系统时间

    有的接口要传递当前的日期或时间,可以用__time()函数获取当前时间 ${__time()} 当前时间到计算机元年的毫秒数 ${__time(时间格式)}  以预定的格式显示当前时间  请求示例: ...

  6. A potentially dangerous Request.Form value was detected from the client的解决办法

    网上找了这么多,这条最靠谱,记录下来,以备后用 <httpRuntime requestValidationMode="2.0"/> <pages validat ...

  7. Spring多个版本源码地址分享

    源码地址为:http://repo.spring.io/simple/libs-release-local/org/springframework/spring/,以供研究源码的朋友. 我看了好几本关 ...

  8. 【luogu P2169 正则表达式】 题解

    题目链接:https://www.luogu.org/problemnew/show/P2169 tarjan缩点 + SPFA 缩完点之后加边注意别写错. 也可以不用建两个图,可以在一张图上判断是否 ...

  9. 【题解】洛谷P2426删数

    链接 https://www.luogu.org/problemnew/show/P2426 念念碎 第一次接触到区间DP(瑟瑟发抖) 所以象征性地看了一下题解 这好像是一道比较基础的区间DP吧 但是 ...

  10. Mysql之inner join,left join,right join详解

    首先借用官方的解释下: inner join(等值连接):只返回两个表中联结字段相等的行: left join(左联接):返回包括左表中的所有记录和右表中联结字段相等的记录: right join(右 ...