← Back to problems

40. Light Switch

BEGINNER
BeginnerBooleanLLDState

Model a light that can be turned on, off, or toggled, and report its state.

Model a single light that starts OFF. Process commands from stdin, one per line. Commands: - ON : turn the light on. - OFF : turn the light off. - TOGGLE : flip the light to the opposite state. - STATE : print "ON" or "OFF".
Log in to submit a solution

Comments

Log into join the discussion.