#C495. Find First Non-Repeating Character

    ID: 48544 Type: Default 1000ms 256MiB

Find First Non-Repeating Character

Find First Non-Repeating Character

You are given a string s and your task is to find the first character in the string that does not repeat. If every character in the string repeats, or if the string is empty, output an empty string.

Details:

  • The input is a single string which may contain both upper and lower case letters.
  • The solution is case-sensitive: for example, 'A' and 'a' are considered distinct characters.
  • If there is no non-repeating character, print nothing (i.e. an empty output).

Hint: Use a frequency count of characters, then scan the string again to determine the first character with frequency \(1\).

inputFormat

The input is provided via standard input (stdin). It consists of a single line containing the string s.

outputFormat

The output should be printed to standard output (stdout) as a single line. It is the first non-repeating character in the string. If no such character exists, output an empty string.

## sample
stress
t