Fixed dynamic string input to handle backspace.