Updated string input validation to use global MAX_STR_LEN variable.