Originally posted by san ch: i trie dit by using stringtokenizer but messed it up terriblly
What do you mean by this? Does the above program compile? If not, what errors do you get? If it does, what happens when you try to run it? It would help if you show us the output you get and explain how it differs from what you expect.
If you provide details like this, we will be more than happy to help you track down your problems and find solutions to them.