Adding variables to repeating strings

view story

http://www.unix.com – Hello, I want to add a letter to the end of a string if it repeats in a column. so if I have a file like this: Code: DOG001 DOG0023 DOG004 DOG001 DOG0023 DOG001 the output should look like this: Code: DOG001-a DOG0023-a DOG004 DOG001-b DOG0023-b DOG001-c how can I do this? thanks in advance (HowTos)