find the first duplicated char in a string