c043: ii.歌詞搜尋_EX$(Chorus\_EX)$
Tags : 字串
Accepted rate : 1人/2人 ( 50% ) [非即時]
評分方式:
Tolerant

最近更新 : 2021-03-06 15:33

Content

我們在聽歌的時候,通常最令人難忘,最琅琅上口的部分就是副歌(Chorus)了,請你寫一個程式找出一首歌中的副歌部分。

 

副歌通常會重複,不過當然有一些句子也會重複,所以我們可以用以下標準找出副歌:重複出現過的最長連續句子。

 

以Jingle Bells為例:

Dashing through the snow,
In a one-horse open sleigh.
O'er the fields we go,
Laughing all the way.
Bells on bobtail ring,
Making spirits bright.
What fun it is to ride and sing,
A sleighing song tonight!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
A day or two ago,
I thought I'd take a ride.
And soon, Miss Fanny Bright,
Was seated by my side.
The horse was lean and lank,
Misfortune seemed his lot.
He got into a drifted bank,
And then we got upsot.
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!

 

在這首歌中,粗體部分便是副歌,當然"In a one-horse open sleigh."重複兩次,而副歌本身也是由重複部分組成,但是你可以發現你找不到超過八句的連續句子在這首歌裡出現超過一次,所以可以確定副歌就是這個。注意你不能把句子拆開,例如把"upsot"與"tonight"的"t"劃入副歌的部分是不可以的。還有也要注意副歌必須是連續句子。以及標點符號也在考慮範圍內喔!

 

Input

輸入共十首歌。(一首歌不超過200行,每行不超過100字)

每兩首歌之間以一行 "======"(不含引號)分隔。

注意第十首歌後面沒有分隔線。

Output

輸出副歌部分。(此方法可能無法找出特定曲目的副歌,但你可以假設測資內所有曲目皆可以用上述方法找出)

每兩首歌的副歌之間請以一行"======"(不含引號)分隔。

注意第十首歌後面沒有分隔線。

Sample Input
Dashing through the snow,
In a one-horse open sleigh.
O'er the fields we go,
Laughing all the way.
Bells on bobtail ring,
Making spirits bright.
What fun it is to ride and sing,
A sleighing song tonight!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
A day or two ago,
I thought I'd take a ride.
And soon, Miss Fanny Bright,
Was seated by my side.
The horse was lean and lank,
Misfortune seemed his lot.
He got into a drifted bank,
And then we got upsot.
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
======
(輸入太長省略)
Sample Output
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
Jingle bells, jingle bells,
Jingle all the way.
Oh what fun it is to ride,
In a one-horse open sleigh!
======
(輸出太長省略)
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 0.1s , <1M
Hint :

本題的時間限制為0.1秒

Tags:
字串
出處:
臺中一中電腦資訊研習社 [管理者:
810848 (路過)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」