PUCMM003 - Longest Smiley Face
Jennifer and Alan were so bored one day in class that they decided to do something about it.
They agreed to play "Longest Smiley Face". A smiley face is a string composed by one or more colon characters (':') followed by one or more right-parenthesis characters (')'). The following are thus smiley faces:
:) :::) :))))) :::::::::::)))))))))))))))
The game is played by a series of turns. Jennifer is the first one to go ("ladies first"). On each turn, a player writes down a smiley face on a piece of paper. Then, the next player writes his or her smiley face next to the other player's last smiley face. Because they were so bored, they weren't really actively counting the length of the current longest smile. As you may think, they now have a huge mess.
Help them determine who won. Given the messy long string full of smiley faces, print the winner.
Input
The first line contains T (1 <= T <= 10), the number of test cases. T lines follow. The i-th test case contains
all the smiley faces of Jennifer and Alan. It is guaranteed that every test case contains an even number of smiley faces. Also, it is guaranteed there are no ties. All of these lines will be non-empty and will contain no more than 100 characters.
Output
For each test case, print a single line: the test's winner! If Jennifer won, print "Jennifer".
Otherwise print "Alan".
Sample Cases
Input | Output |
3 :):)) ::):::) :)))):)))):))))):) |
Alan Alan Jennifer |
Added by: | kojak_ |
Date: | 2013-03-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | 2013 PUCMM Beginners (Round #1) |