#K8806. First Non-Repeating Character in a String

    ID: 37224 Type: Default 1000ms 256MiB

First Non-Repeating Character in a String

First Non-Repeating Character in a String

You are given a string s. Your task is to find the first character in the string that does not repeat itself.

If every character in the string appears more than once, print an empty string. Formally, for a character c in s, let \(count(c)\) denote the number of times c occurs. You must output the first character for which \(count(c) = 1\). If no such character exists, output an empty string.

Examples:

  • Input: leetcode → Output: l
  • Input: aabbcc → Output: (empty string)
  • Input: aabbc → Output: c

inputFormat

The input consists of a single line from the standard input containing the string s. The string may contain letters, digits, and symbols. You can assume the length of s is at least 0 and does not exceed typical constraints for competitive programming problems.

outputFormat

Print the first non-repeating character to the standard output. If every character repeats, output an empty string.

## sample
leetcode
l