Just to elaborate:

The initial problem is that the first code is using nested loops where the second loop is run each time the first loop is incremented. So, the final output of the initial code is
Code:

1 A
1 B
1 C
...
2 A
2 B
2 C
...

_________________________
There are two types of vessels, submarines and targets.