I used an if/ else if loop with the condition under the if part being if the new longest name was longer than the previous longest name which set the new longest name as the current one and under the else if I had if the new longest name was equal to the previous longest name I set a variable = to 1. Later in the code I had another if loop that said if that variable was equal to one then it was a tie so it was taking into account all the ties not just the longest name ones. The solution was to set that variable = to 0 under the first if loop if there was a new longest name, that way even if there was a tie for shorter names the variable would not be set to 1 anymore, therefore not tripping the later if loop that said it was a tie.