How can i make a c# script when clicking a key the character will stop walk ?

I did in the ThirdPersoncontroller clicked on the menu Window > animator and created new empty state called it Walk. Then i set the Walk to be default so now when running the game the character is walking automatic all the time.

Now i want to add a c# script that when i click on some key for example S the character will stop walking.
If i click S again or other key the character will continue walking from the same point it was stop.

This is a screenshot of the ThirdPersoncontroller Window Animator:

Maybe you could make a idle state and call that on key input?