Given an array, find the duplicates in that array, and return a new array of those duplicates. The elements of the returned array should appear in the order when they first appeared as duplicates.
__*Note*__: numbers and their corresponding string representations should not be treated as duplicates (i.e., `"1" != 1`).
## Examples
```
[1, 2, 4, 4, 3, 3, 1, 5, 3, "5"]  ==>  [4, 3, 1]
[0, 1, 2, 3, 4, 5]                ==>  []
```
from typing import List, Union


def duplicates(array: List[Union[int, str]]) -> List[Union[int, str]]:
    d, res = {}, []
    for a in array:
        if d.setdefault(a, 0) == 1:
            res.append(a)
        d[a] += 1

    return res

from typing import List, Union


def duplicates(array: List[Union[int, str]]) -> List[Union[int, str]]:
    d, res = {}, []
    for a in array:
        if d.setdefault(a, 0) == 1:
            res.append(a)
        d[a] += 1

    return res
