We have already declared an enum class State with values: Idle, Busy, Error. We have also provided a helper function toString(State s). The program starts in State::Idle.
enum class State
Idle
Busy
Error
toString(State s)
State::Idle
Your task is to implement the logic that checks the sequence of input commands ("start", "done", "fail") and assigns the correct state transitions:
Finally, print the final state.
Example Input:
3 start done start
Output:
Input:
2 start fail
Test Cases
Test Results
Input
Expected Output