US22 - Implement function to validate grid from input

Fix bugs found related to iterator when wrong entries are detected