"""Moore automaton for a vending machine."""


def next_state(state, inp):
    """Calculate the successor state for a given state and input.

    Args:
      state (int): a natural number, representing the automaton's current state
      inp (string): a string representing the automaton's input

    Returns:
      int: a natural number, representing the automaton's successor state

    """
    pass  # TODO: replace by your implementation


def output(state):
    """Calculate the output in a given state.

    Args:
      state (int): a natural number, representing the automaton's current state

    Returns:
      string: the output of the automaton

    """
    pass  # TODO: replace by your implementation


def automaton():
    """Main loop of the automaton."""
    state = 0
    while True:
        state = next_state(state, input('> '))
        print(output(state))


if __name__ == '__main__':
    automaton()
