+ 1

Help guys what is wrong with my code

Security +100 XP You are in charge of security at a casino, and there is a thief who is trying to steal the casino's money! Look over the security diagrams to make sure that you always have a guard between the thief and the money! There is one money location, one thief, and any number of guards on each floor of the casino. Task: Evaluate a given floor of the casino to determine if there is a guard between the money and the thief, if there is not, you will sound an alarm. Input Format: A string of characters that includes $ (money), T (thief), and G (guard), that represents the layout of the casino floor. Space on the casino floor that is not occupied by either money, the thief, or a guard is represented by the character x. Output Format: A string that says 'ALARM' if the money is in danger or 'quiet' if the money is safe. Sample Input: xxxxxGxx$xxxT Sample Output: ALARM https://code.sololearn.com/c9kWAm9yupfk/?ref=app

28th Jul 2020, 6:21 PM
Agazi Birhanu
Agazi Birhanu - avatar
4 Answers
+ 1
There said any number of gurad in floor.. So for ex: GGT$ it fails.. GTG$ it fails...
28th Jul 2020, 6:50 PM
Jayakrishna 🇼🇳
+ 1
Still may fail because if ex:GTG$ becomes GT$, then it Alarms, but shloud quite. All you need to find whether G is between T and $ or not.
28th Jul 2020, 6:57 PM
Jayakrishna 🇼🇳
+ 1
At last i solved it. Thanks jayakrishna https://code.sololearn.com/ci3Hi53Hb57d/?ref=app
28th Jul 2020, 8:56 PM
Agazi Birhanu
Agazi Birhanu - avatar
0
Good one.. You're welcome..
29th Jul 2020, 9:55 AM
Jayakrishna 🇼🇳