How to check if an input has space or not?