Click the green flag and input names. It can check if the name is new. If you input "exit," however, the program will not add exit to the program and stop.
I barely did anything, just moved some of the code by @CSPExamples.