Did you read the API on the Scanner class?
A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace.
So it needs the (white)space to know where your tokens are.
You may be able to pass it a regex as a
pattern, that would have a whitespace or your operators (with an optional space), but I don't know if you can then get the operator...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors