It's much better but still something is missing... :)
I understand what you have done, but basically it's a bit different.
So, from this example:
Array1:
H,3
E,2
L,1
L,1
O,3
Array2:
E
L
L
L
L
It's ok as you detect the duplicates but the correct result need to be:
Array1:
H,2
E,3
L,1
L,1
O,3
Because second values (Array1), after comma, is what we read from Array2. So, this means, "E" exist but in Array1 is on second position (Array1).
I understand, you try to detect based on Array1, but the order need to be based on Array2 and give us the result.
I hope make sense. But so far, you give me a lot help, i appreciate it. If this works better from your side, as paid work, let me know and contact me please via email: contactsgj@odiusfly.com to discuss more.
Thanks!