就是求出现了多少次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. 《Postgre SQL 即学即用 (第三版)》 分享 pdf下载

    链接:https://pan.baidu.com/s/1akR33VqEkt99UqJUfiy2OA提取码:3p1k

  2. DebuggerVisualizer时,序列化引出的问题。

    实现如下功能:http://www.cnblogs.com/devil0153/archive/2010/09/01/Visual-Studio-Custom-Debugger.html#288924 ...

  3. 使用OpenCV通过摄像头捕获实时视频并探测人脸

    在Opencv初接触,图片的基本操作这篇手记中,我介绍了一些图片的基本操作,视频可以看作是一帧一帧的图片,因此图片操作其实是视频操作的基础,这篇手记就来讲讲OpenCV中的视频操作,并实现一个用笔记本 ...

  4. linux cat显示若干行

    [一]从第3000行开始,显示1000行.即显示3000~3999行 cat filename | tail -n +3000 | head -n 1000 [二]显示1000行到3000行 cat ...

  5. 互评Beta版本——可以低头,但没必要——取件帮

    基于NABCD评论作品,及改进建议 1. 根据(不限于)NABCD评论作品的选题 (1)N(Need,需求) 取件帮是一款有偿互助取件的微信小程序,很大程度上解决了学生因为距离.时间等原因无法取快递的 ...

  6. 20135234mqy-——信息安全系统设计基础第七周学习总结

    第六章 存储器层次结构 存储器系统是一个具有不同容量,成本和访问时间的存储设备的层次结构. CPU寄存器保存着最常用的数据. 靠近CPU的小的,快速的高速缓存存储器作为一部分存储在相对较慢的主存储器( ...

  7. iOS开发学习-给圆形图片添加边框

    imageView.layer.cornerRadius = imageView.bounds.size.width * 0.5;// 设置圆角刚好是自身宽度的一半,就刚好是圆形 imageView. ...

  8. Leetcode题库——31.下一个排列

    @author: ZZQ @software: PyCharm @file: nextPermutation.py @time: 2018/11/12 15:32 要求: 实现获取下一个排列的函数,算 ...

  9. mvc 路由配置-学习2

    public class RouteConfig {    public static void RegisterRoutes(RouteCollection routes)    {       r ...

  10. 关于mybatis的思考(3)——ResultMaps的使用

    ResultMap元素在mybatis中非常重要,目的是告诉mybatis将从结果集中取出的数据转换为开发者需要的对象.     UserMapping.xml <!-- selectAll操作 ...