字符串的处理

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

 #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. mvc报( 检测到有潜在危险的 request.form 值 )错的解决方案

    今天在做项目中遇到了报( 检测到有潜在危险的 request.form 值 )错,百度过后解决了该问题,出此问题主要还是因为提交的Form中有HTML字符串,例如你在TextBox中输入了html标签 ...

  2. html5 input 标签

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content ...

  3. Elasticsearch (1) - 索引库 文档 分词

    创建索引库 ES的索引库是一个逻辑概念,它包括了分词列表及文档列表,同一个索引库中存储了相同类型的文档.它就相当于MySQL中的表,或相当于Mongodb中的集合. 关于索引这个语: 索引(名词):E ...

  4. ES6学习笔记(12)----Reflect

    参考书<ECMAScript 6入门>http://es6.ruanyifeng.com/ Reflect 1.概述:Object对象的内部方法都能在Reflect中找到,同时Reflec ...

  5. laravel学习笔记(三)

    模型传值 路由: Route::get('/posts/{post}','\App\Http\Controllers\PostController@show'); 方法: public functio ...

  6. 《深入理解Java虚拟机》读书笔记

    堆分配参数: -XX:+PrintGC 使用该参数,虚拟机启动后,只要遇到GC就会打印日志: -XX:+UseSerialGC 配置串行回收器: -XX:+PrintGCDeltails 可以查看详细 ...

  7. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 忘记mysql密码

    [root@mysql-db03 ~]# mysql -uroot -poldboy123Warning: Using a password on the command line interface ...

  8. Unity3D windows平台视频录制录屏插件 UnityRecorder

    例子:从官方例子简单改了 using UnityEditor;using UnityEditor.Recorder;using UnityEditor.Recorder.Input;using Sys ...

  9. 如何在windows 2008 IIS7 上实现AD域的访问控制

    1.服务器加入域 2.创建点站 3.对站站进行设置 3.1设置网站的连接模式 选中站点,在控制台右侧 选择 基本设置 => 选择 应用程序用户 3.2 开启访问模式 选择站点 => 身份验 ...

  10. Springboot 图标更换

    1.将自己的logo图片转为.ico格式的,命名必须为[favicon.ico] 2.将该图片直接放在src/main/resourecs目录下 3.重启项目,刷新一下浏览器缓存,就会发现图标更换了