Use nested string comp. instead of for loop