For each loop skips last index

Reversing the array makes a mess with the check thing. How could it check one array in one way with another in reverse ? This would be a mess with index int operations. I finally found a solution, see below. Thanks for the suggestion though !