#K10681. Unique Characters Checker
Unique Characters Checker
Unique Characters Checker
Given a string s, determine if all characters in the string are unique. In other words, check whether for all indices \(i \neq j\), the condition \(s_i \neq s_j\) holds. The check is case-sensitive, meaning that characters with different cases (e.g., 'a' and 'A') are considered distinct. An empty string is considered to have all unique characters.
Example:
- If
s = "abc"
, then the output isTrue
because all characters are unique. - If
s = "leetcode"
, then the output isFalse
since the letter 'e' repeats.
The problem can be formalized as: Given a string \(s\) of length \(n\), check whether \(\forall i, j \in \{0,1,\ldots,n-1\}\) with \(i \neq j\), it holds that \(s_i \neq s_j\).
inputFormat
The input consists of a single line containing the string s. The string may be empty.
outputFormat
Output True
if all characters in the given string are unique; otherwise, output False
. The output should be printed on a single line.
abc
True