added input string format checking