You are given a string S consisting of lowercase English letters. Determine whether all…
- User
You are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.
Constraints
- 2 ≤ |S| ≤ 26, where |S| denotes the length of S.
- S consists of lowercase English letters. Input
Input is given from Standard Input in the following format:
S
Output
If all the characters in S are different, print
yes(case-sensitive); otherwise, printno.Examples
Input
uncopyrightable
Output
yes
Input
different
Output
no
Input
no
Output
yes
Assistant
We need to solve a simple problem: given a string S of length between 2 and 26 inclusive, consisting of lowercase English letters, we need to determine if all characters are distinct. Output "yes" if distinct, else "no". The examples show that for "uncopyrightable" it's yes (all letters unique), for "different" it's no (duplicate letters? Let's check: d i f f e r e n t -> f appears twice, e appears twice). For "no", length 2, both letters are different, so yes.
The constraints: max length 26, there are 26 lowercase letters, so you can't have more than 26 different characters. So we can just check for duplicates.
Implementation: read S, create a set of characters, compare len(set(S)) with len(S). If equal, print "yes", else "no".
Edge cases: none.
We'll provide solution in Python.
Write code:
def main(): import sys S = sys.stdin.readline().strip() if len(set(S)) == len(S): print("yes") else: print("no")
if name == "main": main()
That's it. ```python
import sys
def main() -> None: S = sys.stdin.readline().strip() # Compare the length of the string with the number of distinct characters. if len(set(S)) == len(S): print("yes") else: print("no")
if name == "main": main()