improved readibility

Compressed the code for string input