就是求出现了多少次doge 不区分大小写  巧用字符串函数

   isalpha 判断是否是字母

   tolower 转换为小写字母 toupper 转换为大写字母

   strncmp字符串比较函数  能限制比较的长度

  

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <cctype>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define rap(i, a, n) for(int i=a; i<=n; i++)
#define rep(i, a, n) for(int i=a; i<n; i++)
#define lap(i, a, n) for(int i=n; i>=a; i--)
#define lep(i, a, n) for(int i=n; i>a; i--)
#define rd(a) scanf("%d", &a)
#define rlld(a) scanf("%lld", &a)
#define rc(a) scanf("%c", &a)
#define rs(a) scanf("%s", a)
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff; char s[maxn];
int cnt; int main()
{
cnt = ;
while(gets(s))
{
int len = strlen(s);
for(int i=; i<len; i++)
if(isalpha(s[i]))
s[i] = tolower(s[i]);
for(int i=; i<len; i++)
if(strncmp(s+i, "doge", ) == )
cnt++; }
cout<< cnt <<endl; return ;
}

Wow! Such Doge! HDU - 4847(虽然是道水题 但很有必要记一下)的更多相关文章

  1. (KMP 水)Wow! Such Doge! -- hdu -- 4847

    http://acm.hdu.edu.cn/showproblem.php?pid=4847 Wow! Such Doge! Time Limit:1000MS     Memory Limit:32 ...

  2. Wow! Such Doge! - HDU 4847 (水题)

    题目大意:题目描述了一大堆.....然而并没什么用,其实就是让求给的所有字符串里面有多少个"doge",不区分大小写.   代码如下: ====================== ...

  3. HDU 4847 陕西邀请赛A(水)

    HDU 4847 Wow! Such Doge! pid=4847" style="">题目链接 题意:给定文本,求有几个doge,不区分大写和小写 思路:水题.直 ...

  4. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  5. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  6. HDU 5590 ZYB's Biology 水题

    ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

  7. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  8. hdu 5104 素数打表水题

    http://acm.hdu.edu.cn/showproblem.php?pid=5104 找元组数量,满足p1<=p2<=p3且p1+p2+p3=n且都是素数 不用素数打表都能过,数据 ...

  9. ZOJ3778--一道水题

    Description As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the ...

随机推荐

  1. Memached、Redis、Mongodb的区别

    性能 ​ • 性能都很高,redis和memached差不多 > Mongodb 操作 ​ • Memached:数据结构单一,只有key/value数据结构 ​ • Redis有五种数据类型 ...

  2. AssetBundle压缩/内部结构/下载和加载

    一.AssetBundle的压缩方式   Unity支持三种AssetBundle打包的压缩方式:LZMA, LZ4, 以及不压缩.    1.LZMA压缩方式  是一种默认的压缩形式,这种标准压缩格 ...

  3. tomcat 项目的搭建-【Linux】

  4. Git----02本地仓库进行文件添加&修改&删除&查看

    一.将新文件上传到本地仓库----使用小乌龟工具 1.1.将文件添加到暂存区 进入仓库目录,创建文件,添加暂存区     1.2.将文件添加到本地仓库 选中已经添加到暂存区的文件,进行提交 二.查看本 ...

  5. maven摘除jar包中配置文件

    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-p ...

  6. [linux] 利用PROMPT_COMMAND实现命令审计

    网上查了实现命令审计大概有以下几种: 查不到了,改天再补充 以下环境基于CentOS 6 1.修改history时间格式 echo 'HISTTIMEFORMAT="%F %T " ...

  7. JVM新生代老年代详解

    1.为什么会有年轻代 我们先来屡屡,为什么需要把堆分代?不分代不能完成他所做的事情么?其实不分代完全可以,分代的唯一理由就是优化GC性能.你先想想,如果没有分代,那我们所有的对象都在一块,GC的时候我 ...

  8. 第十二周PSP

  9. Daily Scrumming* 2015.10.27(Day 8)

    一.总体情况总结 今日项目总结: 前后端同一了API设计以及API权限认证.用户状态保存的开发方案 API以及后端模型已经开始开发,前端UEditor开始学习,本周任务有良好的起步 前后端完成分工,后 ...

  10. YQCB冲刺周第四天

    上图站立会议 任务看板: 今天的任务:做登录身份的验证,区别普通用户和超级管理员 遇到的困难:中文乱码问题