http://acm.hdu.edu.cn/showproblem.php?pid=4847

Wow! Such Doge!

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description


Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Internet Meme. Wow.”. Gawker. Retrieved November 22, 2013.

Doge is an Internet meme that became popular in 2013. The meme typically con- sists of a picture of a Shiba Inu dog ac- companied by multicolored text in Comic Sans MS font in the foreground. The text, representing a kind of internal monologue, is deliberately written in broken English, and usually contains the word “wow” and the phrases “such x”, “much x”, “many x”, “very x” and “so x”. 
Kabosu, the Shiba Inu featured in the original meme, was first pictured in a 2010 blog post by Atsuko Sato, a Japanese kindergarten teacher. Afterwards, varia- tions of the pictures using overlaid Comic Sans text were posted from a Tumblr blog, Shiba Confessions. However, the use of the intentionally misspelled “doge” dates back to June 2005, when it was mentioned in an episode of Homestar Runners puppet series. 
In August 2013, images of the meme were spammed on Reddit’s r/MURICA subreddit by 4chan’s random imageboard, /b/. A search of the term doge on Google Trends shows an explosion of popularity occurring in October 2013, and more so in the following month. By November 2013, the meme had become widespread on the Internet. Google later created a Doge Easter egg: when doge meme was entered into the YouTube search bar, all of the site’s text would be displayed in colorful Comic Sans, similar to the kind used by the meme. 
The meme was ranked #12 on MTV’s list of “50 Things Pop Culture Had Us Giving Thanks For” in 2013. Io9 compared the internal dialog of the Shiba Inu dogs to lolcat-speak. The image most commonly associated with the meme is of a female Shiba Inu named Kabosu, taken from a Japanese blog documenting the dog’s daily activities. The spelling of doge has several variants, leading to debate on its actual pronunciation. On December 13, Doge was named the “top meme” of 2013 by Know Your Meme. 
In December 2013, the Dogecoin was introduced as a new cryptocurrency, making it the first cryptocurrency to be based on an Internet meme; the viral phenomenon, along with usage of the Comic Sans MS typeface, gave it “the Internet density of a large star” according to Medium writer Quinn Norton. 
In late December 2013, members of the U.S. Congress produced material in the meme’s style. Huffington Post commented that Doge was “killed” because of the Congress members’ usage of the meme. 
By early 2014, Doge’s popularity was sustained by internet communities on social media, accompanied by the rapid growth and acceptance of Dogecoin. In April 2014, Doge experienced a second major media resurgence due to revelations of the Dogecoin community’s intent to sponsor Josh Wise in NASCAR and place a picture of the Shiba Inu on his vehicle.

―― Doge (meme). (2014, May 18). 
In Wikipedia, The Free Encyclopedia. Retrieved 02:00, May 22, 2014, from 
http://en.wikipedia.org/w/index.php?title=Doge_(meme)&oldid=609040691

Now, Doge wants to know how many words “doge” are there in a given article. Would you like to help Doge solve this problem?

 

Input

An article that Doge wants to know. 
The size of the article does not exceed 64KB. The article contains only ASCII characters.
 

Output

Please output the number of word “doge” (case- insensitive). Refer to the samples for more details.
 

Sample Input

adoge
cutedo
yourge
blownDoge
lovelyDooge
Wow! Such Dooooooooooooooge!!!
D0ge
dOge
DOGE
dogedoge
 

Sample Output

6
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm> using namespace std;
#define INF 0x3f3f3f3f
#define N 1000007 char M[N], S[N]="doge";
int Next[N], ans; void FindNext(char m[])
{
int i=, j=-;
int mlen = strlen(m);
Next[] = -; while(i<mlen)
{
if(j==- || m[i]==m[j])
Next[++i] = ++j;
else
j = Next[j];
}
} void KMP(char M[], char S[])
{
int i=, j=;
int Mlen = strlen(M), Slen = strlen(S); while(i<Mlen)
{
while(j==- || ((M[i]==S[j] || M[i]-'A'+'a'==S[j]) && i<Mlen && j<Slen))
i++, j++; if(j==Slen)
ans++; j = Next[j];
}
} int main()
{
int sum = ; FindNext(S); while(gets(M))
{
ans = ; KMP(M, S); sum += ans;
} printf("%d\n", sum);
return ;
}

(KMP 水)Wow! Such Doge! -- hdu -- 4847的更多相关文章

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

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

  2. Wow! Such Doge! HDU - 4847(虽然是道水题 但很有必要记一下)

    就是求出现了多少次doge 不区分大小写  巧用字符串函数 isalpha 判断是否是字母 tolower 转换为小写字母 toupper 转换为大写字母 strncmp字符串比较函数  能限制比较的 ...

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

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

  4. HDU 4847 Wow! Such Doge!

    Wow! Such Doge! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  5. HDU-4847 Wow! Such Doge!,模拟!

    Wow! Such Doge! 题意:给定的字符串中doge出现了多少次,直接模拟即可,不用KMP. char s[N]; int main() { // int n; int ans=0; whil ...

  6. poj-2406(kmp水题)

    题意:定义一个a*b=字符串a连接字符串b:给你一个字符串s,问你这个字符串最多能用多少个字符串t连接得到:例如:aaaa=4个a构成: 解题思路:kmp水题,next数组除了查找字串以外最广泛的一种 ...

  7. hdu4847:Wow! Such Doge!(字符串匹配)

    题目:hdu4847:Wow! Such Doge! 题目大意:在给出的段落里面找出"doge"出现的次数.大写和小写都能够. 解题思路:字符串匹配问题,能够在之前将字母都转换成统 ...

  8. HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)

    Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Meme. ...

  9. hdu4847 Wow! Such Doge! KMP

    Chen, Adrian (November 7, 2013). “Doge Is An Ac- tually Good Internet Meme. Wow.”. Gawker. Retrieved ...

随机推荐

  1. Python基础杂点

    Black Hat Python Python Programming for Hackers and Pentesters by  Justin Seitz December 2014, 192 p ...

  2. 岭回归和lasso回归(转)

    回归和分类是机器学习算法所要解决的两个主要问题.分类大家都知道,模型的输出值是离散值,对应着相应的类别,通常的简单分类问题模型输出值是二值的,也就是二分类问题.但是回归就稍微复杂一些,回归模型的输出值 ...

  3. Ansible 从MySQL数据库添加或删除用户

    mysql_user - 从MySQL数据库添加或删除用户. 概要 要求(在执行模块的主机上) 选项 例子 笔记 状态 支持 概要 从MySQL数据库添加或删除用户. 要求(在执行模块的主机上) My ...

  4. new operator

    [new operator] When the code new Foo(...) is executed, the following things happen: A new object is ...

  5. url获取参数

    参考http://www.runoob.com/w3cnote/js-get-url-param.html function getQueryVariable(variable) { var quer ...

  6. C#aspx页面前台使用<%=%>无法取到后台的值

    检查是不是有拼接问题,正常public和protected修饰的字段或属性均可使用<%=%>.另外,加载(Page_Load)时有没有给它们赋初始值? 答 1)前台页面只能调用本后置代码的 ...

  7. float数据类型研究,发现其能显示的有效数字极为有限

    1. 范围  float和double的范围是由指数的位数来决定的.  float的指数位有8位,而double的指数位有11位,分布如下:  float:  1bit(符号位) 8bits(指数位) ...

  8. 84直方图最大矩形覆盖 · Largest Rectangle in Histogram

    [抄题]: Given n non-negative integers representing the histogram's bar height where the width of each ...

  9. JS 图片切换

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="zzzz.aspx.cs&quo ...

  10. 实现Quartz的动态增删改查

    1. Maven依赖 <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId> ...