Homework2 modified search with dictionary