Problem E
Undead or Alive
Now that zombies have learned to use SMS messaging, it is imperative to develop software for detecting zombies over text. After many long months of study, the top scientists have figured out how to do it. The key observation is that humans only use smiley faces, represented by the exact substring :), and zombies only use frowny faces, represented by the exact substring :(. However, upon realizing this, double agents were trained to use both kinds of emoticons at once! Your job is to write a program to determine who a given message is from.
Input
The input will consist of a single line of text, no longer than $160$ characters, containing letters, numbers, spaces, and any of the following symbols: .,'!?:)(.
Output
-
If the line contains only smiley faces and no frowny faces, then output alive.
-
If the line contains only frowny faces and no smiley faces, then output undead.
-
If the line contains both smiley faces and frowny faces, then output double agent.
-
Otherwise, output machine.
Sample Input 1 | Sample Output 1 |
---|---|
Hello, how are you? :) |
alive |
Sample Input 2 | Sample Output 2 |
---|---|
Hey there! :( What's up? :( |
undead |
Sample Input 3 | Sample Output 3 |
---|---|
::(Braaaains... are very useful for programming contests:)) |
double agent |
Sample Input 4 | Sample Output 4 |
---|---|
Sandy, when will my order be delivered? |
machine |
Sample Input 5 | Sample Output 5 |
---|---|
Firing up EmoticonBot... (: : ( ): :D c: |
machine |