Countdown while user types

So let's say I wanted to make a program wherein the user has to guess a password, but only has six seconds to do so. How can I make it so the timer counts down even as the user types? At the moment, I only know how to make programs do one thing at a time; while I can easily make a program that counts down from six seconds, or a program that lets a user guess a password, I have no idea how to make a program do both of those things at once. I was hoping you guys here could teach me how to do so.
Thread I answered before:
It is advanced topic actually.
There is another way to do it but it includes infinite loop and asynchronous input which pretty advanced too.
Topic archived. No new replies allowed.