Longest palindrom P34755


Statement
 

pdf   zip

thehtml

Two friends play a simple game: Each of them writes a string by pressing at random the lowercase letters of his keyboard. Afterwards, the one that has the longest palindromic substring in the string just written, wins. Implement a program to help them to decide who is the winner.

Input

Input is a sequence of cases separated by a blank line. Every case has two lines, each with a non-empty string consisting only of lowercase letters. No line has more than 1000 characters.

Output

For every case, print the case number and who wins the game following the sample output.

Observation

Although the sample input is not random, the rest of input is random.

Public test cases
  • Input

    abcabcabc
    banana
    
    wasitaratisaw
    aaaaaaaazzzzzzaaaxxxxxaaaaa
    
    abcdeedcba
    aaaaaaaaaa
    

    Output

    Case #1: The second player wins.
    Case #2: The first player wins.
    Case #3: Tie.
    
  • Information
    Author
    Albert Graells
    Language
    English
    Official solutions
    C++
    User solutions
    C++