I believe that your teacher asks you to process the string yourself (without using any other libraries for this). Make sure this is so - if you can use them, there are things like StringTokenizer, Pattern, and Scanner to simplify string processing.
Otherwise...
(, , , ..), , , . ( ) ( ), reset , .
user289086