actually, this program will give faulty results, since spaces in the input are converted to plus signs by the web browser. The program doesn’t check for this, but that is easy to change. The main concern here is to give the working principle.