The problem is with first name it doesnt count. By the way there are only 10 inputs because i am testing the code with 10 inputs first because if it works with 10 entries then it should work with 20 entries too as per conditions.
Deepak
Dheeraj
Deepak
Deepak
Deepak
Tim
Jim
Tim
Jack
Jim
Dheeraj 1
Tim 2
Jack 1
Deepak 3
Jim 2