#K8656. Duplicate Character Checker
Duplicate Character Checker
Duplicate Character Checker
You are given a string and your task is to determine whether it contains any duplicate characters. For each test case, output YES
if there is at least one character that appears more than once in the string, otherwise output NO
.
The challenge helps you practice basic string manipulation and use of data structures such as sets or arrays for frequency counting.
Note: The solution must read from standard input (stdin) and write the result for each test case to standard output (stdout).
inputFormat
The first line contains an integer T, the number of test cases. Each of the following T lines contains a non-empty string.
Example:
3 abc hello world
outputFormat
For each test case, output a single line containing YES
if the corresponding string contains any duplicate characters, or NO
otherwise.
Example:
NO YES NO## sample
3
abc
hello
world
NO
YES
NO
</p>