No.342 What Made Me LOL the Mostww
タグ : / 解いたユーザー数 132
作問者 :
butchi_y
Note
Since this problem handles UTF8 strings, it may be difficult to solve in some languages.
Problem Statement
Alice: "So just noww I was rereading the stuff I wrotew and I got curious about what cracked me up the mostw so I tried writing a programwww"
Bob: "Thatww I'm super curiousw"
Carol: "I am curious as well."
However, a run of "w" at the beginning of the line is not counted as such a location.
The sentence ends at the character immediately before the longest run of "w".
It starts where, counting from the end of the sentence toward the beginning, the next "w" is about to be reached, or at the beginning of the line if no "w" appears.
If there are two or more longest runs of "w", separate the sentences with newlines. (Output them in order of appearance.)
If "w" never appears, or if all characters are "w", output an empty string.
Input
S
A UTF-8 string (without BOM, consisting of printable characters other than newlines) is given as $S$.
Note that the input may contain ASCII spaces.
The length of the UTF-8 string is at least 1 character and at most 100 characters.
Output
Output the UTF8 string (without BOM) that satisfies the problem statement.
(You normally should not need to worry about this, but if a BOM is attached, the verdict will be WA.)
Print a newline at the end.
Sample
Sample 1
Input
海賊王にw俺はなるww
Output
俺はなる
The run of 2 "w" is the longest, so output the sentence before it.
Sample 2
Input
うはwwwwwおkwwwww
Output
うは おk
There are two longest runs of "w", so output both sentences.
Sample 3
Input
wwそれなww
Output
それな
Ignore the "w" at the beginning of the line.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。