#K44472. First Non-Repeating Character

    ID: 27539 Type: Default 1000ms 256MiB

First Non-Repeating Character

First Non-Repeating Character

You are given T test cases. For each test case, you are provided with a string s. Your task is to find the first character in the string that does not repeat anywhere else in the string. If all characters repeat, output an underscore (_).

More formally, for each character c in the string, if its frequency equals $$1$$, then c is considered non-repeating. Return the first such character in the string. Otherwise, if no such character exists, output _.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer T, the number of test cases.
  • The following T lines each contain a single string s.

outputFormat

For each test case, output on a new line the first non-repeating character of the string. If no such character exists, print an underscore (_).

The output should be written to stdout.

## sample
2
geeksforgeeks
aabbcc
f

_

</p>