#C13375. First Non-Repeating Character
First Non-Repeating Character
First Non-Repeating Character
Given a string s, find the first character that does not repeat. If every character in the string appears more than once, print an asterisk (*
).
The task is to iterate through the string and identify the very first character that occurs exactly once. Use efficient methods for counting character occurrences if possible.
Note: The input string may contain both uppercase and lowercase English letters. The case is significant, i.e., 'a' is considered different from 'A'.
In mathematical notation, let \(s = s_1s_2\dots s_n\), find the smallest index \(i\) such that \(\#(s_i) = 1\). If no such \(i\) exists, output \('*'\).
inputFormat
The input is read from standard input (stdin
) and consists of a single line containing the string s.
outputFormat
Print a single character to standard output (stdout
): the first non-repeating character of the string. If all characters repeat, print *
.
aabbcc
*