博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
杭电oj-2017 字符串统计 C++
阅读量:4033 次
发布时间:2019-05-24

本文共 592 字,大约阅读时间需要 1 分钟。

Problem Description

对于给定的一个字符串,统计其中数字字符出现的次数。

Input

输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。

Output

对于每个测试实例,输出该串中数值的个数,每个输出占一行。

Sample Input

2

asdfasdf123123asdfasdf
asdf111111111asdfasdfasdf

Sample Output

6

9

在这里插入代码片```#include 
#include
using namespace std;const int max_size=101;int main(){ int n; string a[max_size]; //放每行的字符串 int b[max_size]; //放每行的数字个数 while(cin>>n) { for(int i=0;i
>a[i]; b[i]=0; //初始化 } for(int i=0;i
=48&&a[i][j]<=57) b[i]++; for(int i=0;i

转载地址:http://oafdi.baihongyu.com/

你可能感兴趣的文章
微信菜单的配置
查看>>
移动端的emoji表情符号插入MySQL数据库失败
查看>>
mysql对指定列进行排名
查看>>
Eclipse安装FindBugs插件
查看>>
联想T440怎么把原装Win8或Win10换成Win7系统
查看>>
PowerDesigner将物理数据模型图生成图片
查看>>
PowerDesigner创建物理数据模型(PDM)
查看>>
PowerDesigner:导入SQL脚本
查看>>
PowerDesigner使用教程
查看>>
eclipse中使用Ctrl+Alt+↑或↓时屏幕旋转的问题
查看>>
freemarker 数字格式化(金额格式化)
查看>>
eclipse中Deployment Assembly选项设置说明
查看>>
maven项目报:Project configuration is not up-to-date with pom.xml. Run Maven->Update Project
查看>>
pom.xml中maven-compiler-plugin插件配置的使用
查看>>
使用maven-war-plugin 对Maven项目进行动态打包
查看>>
spring定时任务配置
查看>>
Log4j2 配置笔记(Eclipse+maven+SpringMVC)
查看>>
java设计模式之简单工厂模式
查看>>
struts2中constant参数设置
查看>>
Struts2中struts.multipart.maxSize设置
查看>>