The output of my code is not correct. It skips some of the strings and I can't find what the problem is.