finished the program, it now reverses words correctly