In the heart of the dense, misty forests of the Pacific Northwest, the Sasquatchians have a beloved tradition that brings laughter and excitement to their hidden village. This tradition is known as "The Great Sasquatch Stumble."
Every year, the bravest and most agile Sasquatchians gather around a massive stone platform that stands majestically above a shimmering lake. This platform is the stage for their hilarious and thrilling game.
The rules are simple but challenging. A Sasquatch stands proudly in the exact center of the platform, ready to face the ultimate test of balance and luck. As the game begins, a large stone is gently dropped on the Sasquatch's head, causing him to stumble in random directions. The goal is to stay on the platform without falling into the water below.
The Sasquatchians watch in anticipation as their champion stumbles around, taking one step at a time in any of the four cardinal directions: north, south, east, or west. Each step is a gamble, as moving too far in any direction will send the Sasquatch tumbling into the lake, much to the delight of the cheering crowd.
The game is a test of endurance, luck, and a bit of slapstick comedy. The Sasquatchians roar with laughter and cheer for their champion, hoping he can stay on the platform and win the game. If he succeeds, he is celebrated as a hero, but if he falls, the splash and the ensuing laughter echo through the forest.
Will the Sasquatch manage to stay on the platform, or will he take an unexpected plunge into the lake? The Great Sasquatch Stumble is a game of chance and hilarity, and the Sasquatchians wouldn't have it any other way.
Image generated by Microsoft Copilot.
Write a program that takes a number of data sets on the first line, followed by that number of data sets. Each data set will contain a random number of cardinal directions ("North", "South", "East", and "West"), comma+space separated. Sasquatch starts at location (0, 0) on the platform and each cardinal direction changes the x (east/west) or y (north/south) location. You are to determine if sasquatch stays on the platform or falls into the lake.
Input/Output
Example Input:
2
East, East, East, East, East, East, East, East, East, East, East, East, East, East, East
South, North, West, North, North, West, South, South, West, South, South, East, South, West, South, East, West, West, West, North, West, West, East, East, West, South, East, North, South, South, North, South, South, North, East, North, North, North, East, West, South, North, East, North
Expected Output:
Splash!
Safe.