check if string contains duplicate chars function