hw6 fixed pattern matching for ex3