added an alternate method to check for duplicate chars in a string