The first thing that jumps out of the code is that you are initialising and incrementing elements of %first, %second and %third but only printing results from %first.
Cheers,
JohnGG
Comment on Re: Ref: How can I count the number and kinds of letters at 1st, 2nd and 3rd positions of 3-letter words in a string?