Please help me with the task: Antivirus scan.

Hello, I’m working on this task:

Task with high complexity! It is ok to skip :wink:
You need to write a program that sends files to the antivirus scan. It should scan files only when Ritchie is NOT watching Noname’s state. The program should understand 4 commands: “scan”, “hide”, “unhide”, and “game over”. It should have two modes that can be toggled by using the commands “hide” and “unhide” commands. The default mode is “unhide”, which means that Ritchie is not watching. If the input is “scan” during the mode “unhide”, the program should output “scanning file {number}” where number is an integer that starts from 1 and increments by 1 for every new file. If the user inputs “scan” during the “hide” mode, the program should output “can’t scan files for viruses”. As soon as Ritchie leaves, the input will be switched to “unhide” and then it should be able to scan again. Your program should listen to the input commands indefinitely until the input is “game over”. In this case, the program should output “run” and exit. For example:
>scan
scanning file 1
>scan
scanning file 2
>hide
>scan
can’t scan files for viruses
>scan
can’t scan files for viruses
>unhide
>scan
scanning file 3
>game over
run

Can anyone please help me to solve it?