#C10915. First Non-Repeating Character
First Non-Repeating Character
First Non-Repeating Character
Given a list of strings, your task is to find the first non-repeating character in each string. For each string, traverse the characters from left to right and identify the first character which does not repeat in the string. If every character in a string repeats, output an empty string for that particular string.
Input Format: The input starts with an integer \(T\) representing the number of strings. This is followed by \(T\) lines where each line contains a single string.
Output Format: For each input string, output its first non-repeating character on a new line. If there is no such character, output nothing (i.e., an empty line).
Example: For the string "abacabad", the first non-repeating character is 'c'.
inputFormat
The first line of input contains a single integer \(T\) denoting the number of strings. This is followed by \(T\) lines, each containing a string for which you need to find the first non-repeating character.
outputFormat
Output exactly \(T\) lines. The \(i^{th}\) line should contain the first non-repeating character for the \(i^{th}\) input string. If there is no non-repeating character, output an empty line.
## sample1
abc
a
</p>