Snake Length

Easy · rating 950 · Strings, Simulation

In a snake game the snake starts at length 1. Read a string of moves: F eats food and grows the snake by 1; X means it crashed into itself and the game ends immediately; any other character is an ordinary move. Print the snake's length when the game ends.

Related problems

Open Snake Length in Code Arena →