Originally Posted by weezer562
Ok, well we can modify this to do something similar. Once again, if there are spaces between the numbers and symbols, we can use the next() method
while the scanner hasNext()
. Then, if you keep a count of how many times you call that next() method
, you can tell if it is a symbol or number (even are numbers and odd are symbols, starting from 0). You can then do basically the same thing I did above.
That way we are using the scanner methods but still doing the same thing technically.