After receiving a terrible grade on her report, Wandy must rewrite her finance paper. Still upset, she wants, this time, to only submit a paper with sentences that have alliteration (the first letters of each word are the same).
Can you, her programmer friend, help her once again by printing the longest sequence of words beginning with a given character?
Input Specification
The first line will be the character (either an uppercase or lowercase letter), , that will be searched for in the string.
The second and final line will be a paragraph, , including at least one word beginning with character (either uppercase or lowercase). The paragraph will consist of words (uppercase and lowercase alphabetical characters), separated by spaces and period punctuation. It is guaranteed that there will be only one longest possible substring.
Output Specification
The longest possible substring in which all words begin with either uppercase or lowercase character .
Sample Input
a
All admit anger about the absolutely awful All About Alliteration.
Sample Output
absolutely awful All About Alliteration.
Explanation
Two substrings with alliteration with the letter a
exist. The longest substring with all words beginning with a
is admit anger about
, but the longest substring with all words beginning with either lowercase a
or uppercase A
is absolutely awful All About Alliteration
, so the output is absolutely awful All About Alliteration.
.
Comments