Code

split and validate input more robustly