Wow! Such Doge!(KMP做法)

Doge是一种始于2013年的网络迷因,以柴犬Kabosu的形象和故意使用错误英语的彩色文本为特征。这一迷因最初在Tumblr上出现,随后在Reddit和4chan等平台上迅速流行。Doge的拼写变化和Comic Sans MS字体的使用使其成为广泛讨论的话题。2013年,Doge被MTV评为当年第12位最具影响力的文化现象,且同年引入了基于该迷因的加密货币Dogecoin。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述
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
低端的题目往往需要用到高级的解题方法(doge)

#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int Next_doge[10];
int Next_Doge[10];
int Next_dOge[10];
int Next_doGe[10];
int Next_dogE[10];
int Next_DOge[10];
int Next_DoGe[10];
int Next_DogE[10];
int Next_dOGe[10];
int Next_dOgE[10];
int Next_doGE[10];
int Next_DOGe[10];
int Next_dOGE[10];
int Next_DOGE[10];
void getnext(int next[], const char str[])
{
    int m = strlen(str);
    int j = 0, k = -1;
    next[0] = -1;
    while (j < m)
    {
        if (k == -1 || str[j] == str[k])
        {
            j++;
            k++;
            next[j] = k;
        }
        else
            k = next[k];
    }
}
int kmp(const char str1[],const char str2[], int Next[])
{
    int cnt = 0;
    int i = 0, j = 0;
    int n = strlen(str1);
    int m = strlen(str2);
    while (i < n)
    {
        if (j == -1 || str1[i] == str2[j])
        {
            i++;
            j++;
        }
        else
            j = Next[j];
        if (j == m)
        {
            cnt++;
            j = 0;
        }
    }
    return cnt;
}
void init_next()
{
    getnext(Next_doge, "doge");
    getnext(Next_Doge, "Doge");
    getnext(Next_dOge, "dOge");
    getnext(Next_doGe, "doGe");
    getnext(Next_dogE, "dogE");
    getnext(Next_DOge, "DOge");
    getnext(Next_DoGe, "DoGe");
    getnext(Next_DogE, "DogE");
    getnext(Next_dOGe, "dOGe");
    getnext(Next_dOgE, "dOgE");
    getnext(Next_doGE, "doGE");
    getnext(Next_DOGe, "DOGe");
    getnext(Next_dOGE, "dOGE");
    getnext(Next_DOGE, "DOGE");
}
int main()
{
    int cnt = 0;
    char s1[100000];
    init_next();
    while(cin >> s1)
        cnt += kmp(s1, "doge", Next_doge)+ kmp(s1, "Doge", Next_Doge) + kmp(s1, "dOge", Next_dOge) + kmp(s1, "doGe", Next_doGe) + kmp(s1, "dogE", Next_dogE) + kmp(s1, "DOge", Next_DOge) + kmp(s1, "DoGe", Next_DoGe) + kmp(s1, "DogE", Next_DogE) + kmp(s1, "dOGe", Next_dOGe) + kmp(s1, "DOgE", Next_dOgE) + kmp(s1, "doGE", Next_doGE) + kmp(s1, "DOGe", Next_DOGe) + kmp(s1, "dOGE", Next_dOGE) + kmp(s1, "DOGE", Next_DOGE);
    cout << cnt << endl;
    return 0;
}

233333333

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值