#K7381. Count Unique Single-occurrence Characters
Count Unique Single-occurrence Characters
Count Unique Single-occurrence Characters
Given a string \(S\), your task is to count the number of distinct characters that appear exactly once in the string. More formally, if \(f(c)\) is the frequency of character \(c\) in \(S\), you are to compute the number of characters for which \(f(c) = 1\).
For example:
- For \(S =\) "programming", the answer is 5 because the characters 'p', 'o', 'a', 'i', and 'n' appear exactly once.
- For \(S =\) "abcdabcdabcd", every character appears more than once, so the answer is 0.
- For \(S =\) "hello", the answer is 3.
The solution should read input from standard input (stdin) and write the output to standard output (stdout).
inputFormat
The input consists of a single line containing the string \(S\). The string may include spaces and other printable characters.
outputFormat
Output a single integer: the number of distinct characters in \(S\) that appear exactly once.
## sampleprogramming
5