字符串的处理

统计已有字符的个数 和需求字符比较

 #include <iostream>
#include <stdio.h>
#include <string.h> using namespace std; int head[];
int text[];
char input[];
int main()
{
freopen("in.txt", "r", stdin);
gets(input);
for (int i = ; i < strlen(input); i++)
{
if (input[i] >= 'a' && input[i] <= 'z')
{
head[input[i] - 'a']++;
}
else if ( input[i] >= 'A' && input[i] <= 'Z' )
{
head[input[i] - 'A'+]++;
}
}
gets(input);
for (int i = ; i < strlen(input); i++)
{
if (input[i] >= 'a' && input[i] <= 'z')
{
text[input[i] - 'a']++;
}
else if ( input[i] >= 'A' && input[i] <= 'Z' )
{
text[input[i] - 'A'+]++;
}
}
bool judge = true;
for (int i = ; i < ; i++)
{
if (text[i] > head[i] )
{
judge = false;
break;
}
}
if (judge) printf("YES\n");
else printf("NO\n");
}

CodeForces - 43B Letter的更多相关文章

  1. Codeforces 180C - Letter - [简单DP]

    题目链接:http://codeforces.com/problemset/problem/180/C 题意: 有一段字符串,包含大小写字母,每次可以将其中一个字母由大写变成小写,或者小写变成大写.要 ...

  2. codeforces 14A - Letter & codeforces 859B - Lazy Security Guard - [周赛水题]

    就像title说的,是昨天(2017/9/17)周赛的两道水题…… 题目链接:http://codeforces.com/problemset/problem/14/A time limit per ...

  3. Codeforces 180C. Letter

    题目链接:http://codeforces.com/problemset/problem/180/C 题意: 给你一个仅包含大写字母和小写字母的字符串,你可以将让小写字母转化为大写字母,大写字母转化 ...

  4. Codeforces 180C Letter:dp

    题目链接:http://codeforces.com/problemset/problem/180/C 题意: 给你一个字符串s,长度为n. 让你将这个字符串变成“前面一段都是大写字母,后面一段都是小 ...

  5. Codeforces Round #284 (Div. 2)A B C 模拟 数学

    A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...

  6. cf499B-Lecture 【map】

    http://codeforces.com/problemset/problem/499/B B. Lecture     You have a new professor of graph theo ...

  7. 物联网学生科协第三届H-star现场编程比赛

    问题 A: 剪纸片 时间限制: 1 Sec 内存限制: 128 MB 题目描写叙述 这是一道简单的题目,假如你身边有一张纸.一把剪刀.在H-star的比赛现场,你会这么做: 1. 将这张纸剪成两片(平 ...

  8. Codeforces Round #116 (Div. 2, ACM-ICPC Rules) C. Letter 暴力

    C. Letter Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/180/problem/C D ...

  9. Codeforces Beta Round #14 (Div. 2) A. Letter 水题

    A. Letter 题目连接: http://www.codeforces.com/contest/14/problem/A Description A boy Bob likes to draw. ...

随机推荐

  1. [转]Android APK签名原理及方法

    准备知识:数据摘要 这个知识点很好理解,百度百科即可,其实他也是一种算法,就是对一个数据源进行一个算法之后得到一个摘要,也叫作数据指纹,不同的数据源,数据指纹肯定不一样,就和人一样. 消息摘要算法(M ...

  2. a=a+b与a+=b的区别

    在一次工作中身边的一位资深的同事突然问了个a=a+b与a+=b有什么区别 此时有点尴尬了 不知道是真的不知道咧还是别有用意....今天抽点时间针对此问题做个小总结 一.性能方面 a=a+b是加法运算 ...

  3. Mac Outlook 15 连接office365 一直跳出登录框的问题

    解决: 比如 原登录用户名密码为 abc@xxx.com 密码:***** 改一下outlook帐号中的登录用户名为:xxx.com\abc   密码为原来密码,尝试连接,连接状态会连上,但过会儿又提 ...

  4. Ubuntu 创建docker 容器 系列一

    docker 官网安装地址:https://docs.docker.com/install/linux/docker-ce/ubuntu/ 1.Ubuntu的版本要在12.04 LTS 以上,使用un ...

  5. 【译】OpenStack Heat基础介绍

    原文:http://blog.scottlowe.org/2014/05/01/an-introduction-to-openstack-heat/ 本文将简要地介绍OpenStack Heat. H ...

  6. Android从图库选择照片

    从机里取照片,开头用网上找的代码测试,导致类似下面这样的Crash:java.lang.RuntimeException: Failure delivering result java.lang.Se ...

  7. 洛谷 P2680 运输计划

    题目背景 公元 2044 年,人类进入了宇宙纪元. 题目描述 L 国有 n 个星球,还有 n-1 条双向航道,每条航道建立在两个星球之间,这 n-1 条航道连通了 L 国的所有星球. 小 P 掌管一家 ...

  8. makefile vpath变量

    在讲vpath之前,我们首先了解以下makefile文件. 在类Unix系统中,当我们使用源码编译某个软件的时候,我们会使用confiure,make,make install这三个命令,其中cofi ...

  9. python基础一 day3 列表

    字符串是有序的,列表也是有序的,有索引值,可以切片 可以用切片来截取列表中的任何部分返回得到一个新列表. 列表方法: 1:增加 结果: 例子:    结果: int类型不可迭代      结果: 删: ...

  10. 转--C#编程总结

    C#编程总结--总目录 http://www.cnblogs.com/yank/p/3543423.html