How to enforce user to input in predefined format?