Created
November 3, 2019 20:43
-
-
Save imedadel/4f11632bdadd57ec6635ed81e56d977c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Counter | |
| word = input().strip() | |
| def sherlock(word): | |
| freq = Counter(word) | |
| freqFreq = Counter(freq.values()) | |
| hasVarFreq = len(freqFreq.values()) > 2 or min(freqFreq.values()) != 1 | |
| if hasVarFreq: | |
| return "NO" | |
| return "YES" | |
| print(sherlock(word)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment