The best - in fact the only - way to see "if it works" is to test the program and see if it gives the correct output.

Try and cover as many possibilities as you can with your test cases: all upper...