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

Problem 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

题目的输出没有结束标志,就是让你在文件结束输出doge这个单词出现的次数,不区分大小写!

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int sum=0;
        while(sc.hasNext()){
            String str =sc.next();
            for(int i=0;i<str.length()-3;i++){
                if(str.charAt(i)=='d'||str.charAt(i)=='D'){
                    if(str.charAt(i+1)=='o'||str.charAt(i+1)=='O'){
                        if(str.charAt(i+2)=='g'||str.charAt(i+2)=='G'){
                            if(str.charAt(i+3)=='e'||str.charAt(i+3)=='E'){
                                sum++;
                                i=i+3;
                            }
                        }
                    }
                }
            }
        }
        System.out.println(sum);

    }

}
时间: 2024-09-20 00:57:19

HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)的相关文章

c# 顺序串字符统计及每个字符出现的次数

问题描述 c# 顺序串字符统计及每个字符出现的次数 请问怎样统计一个顺序串中出现的字符,和每个字符出现的次数,请大神帮帮忙 解决方案 其实你可以用一些最常规的方法实现,比如用一个map,每个字符作为key,遍历一遍,如果map里找到,key对应的value加一 解决方案二: string s = ""here are what you entered"";var query = s.GroupBy(x => x).Select(x => string.C

vbs 字符统计功能模块_vbs

字符统计功能模块 复制代码 代码如下: Sub TongJi() Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("ok.txt", 1) strText = objFile.ReadAll All = Len(strText) S="` ~ ! @ # $ % ^ & * ( ) - _ = + \ | [ { ]

一个字符串中出现次数最多的字符 统计这个次数【实现代码】_javascript技巧

var str = 'asdfssaaasasasasaa'; var json = {}; for (var i = 0; i < str.length; i++) { if(!json[str.charAt(i)]){ json[str.charAt(i)] = 1; }else{ json[str.charAt(i)]++; } }; var iMax = 0; var iIndex = ''; for(var i in json){ if(json[i]>iMax){ iMax = j

HDOJ/HDU 2140 Michael Scofield&amp;#39;s letter(字符转换~)

Problem Description I believe many people are the fans of prison break. How clever Michael is!! In order that the message won't be found by FBI easily, he usually send code letters to Sara by a paper crane. Hence, the paper crane is Michael in the he

HDOJ/HDU 1984 Mispelling4(删除第n个字符~)

Problem Description Misspelling is an art form that students seem to excel at. Write a program that removes the nth character from an input string. Input The first line of input contains a single integer N, (1 ≤ N ≤ 1000) which is the number of datas

HDOJ(HDU) 1860 统计字符

Problem Description 统计一个给定字符串中指定的字符出现的次数 Input 测试输入包含若干测试用例,每个测试用例包含2行,第1行为一个长度不超过5的字符串,第2行为一个长度不超过80的字符串.注意这里的字符串包含空格,即空格也可能是要求被统计的字符之一.当读到'#'时输入结束,相应的结果不要输出. Output 对每个测试用例,统计第1行中字符串的每个字符在第2行字符串中出现的次数,按如下格式输出: c0 n0 c1 n1 c2 n2 - 其中ci是第1行中第i个字符,ni是

HDOJ(HDU) 2153 仙人球的残影(谜一样的题、、、)

Problem Description 在美丽的HDU,有一名大三的同学,他的速度是众所周知的,跑100米仅仅用了2秒47,在他跑步过程中会留下残影的哎,大家很想知道他是谁了吧,他叫仙人球,既然名字这样了,于是他的思想是单一的,他总是喜欢从一点出发,经过3次转折(每次向右转90°),回到出发点,而且呢,他每次转折前总是跑相同长度的路程,所以很多人都想知道如果用'1'算他跑步出发的第一个残影的话,那么回到起点的时候,他的残影是怎么样的呢?   Input 测试数据有多行,每一行为一个数N(1<=N

HDOJ/HDU 1161 Eddy&amp;#39;s mistakes(大写字母转换成小写字母)

Problem Description Eddy usually writes articles ,but he likes mixing the English letter uses, for example "computer science" is written frequently "coMpUtEr scIeNce" by him, this mistakes lets Eddy's English teacher be extremely disco

HDOJ/HDU 1087 Super Jumping! Jumping! Jumping!(经典DP~)

Problem Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can be played by two or more t