You might want to put an assert here for the case where the input string is too long.