#K84392. First Non-Repeating Character
First Non-Repeating Character
First Non-Repeating Character
Given a string s, your task is to find and output the first non-repeating character in s. If there is no such character, output an empty string.
The problem can be modeled using the following concept:
For a character c in the string, determine its frequency \(f(c)\) and identify the first character for which \(f(c)=1\). If no character meets this criterion, output an empty string.
Examples:
- Input: "leetcode" → Output: "l"
- Input: "loveleetcode" → Output: "v"
- Input: "aabb" → Output: ""
inputFormat
Input is read from standard input (stdin) as a single line containing the string s. The string may include spaces and printable ASCII characters.
outputFormat
Output the first non-repeating character from the input string to standard output (stdout). If no such character exists, output an empty string.## sample
leetcode
l