#K95082. Equal Frequency of Characters
Equal Frequency of Characters
Equal Frequency of Characters
You are given a string s consisting of lowercase English letters. Your task is to determine if all the distinct characters in the string occur the same number of times. Formally, let \(d\) be the number of distinct characters and let \(f_i\) be the frequency of the \(i\)-th distinct character. The answer is True
if \(f_1 = f_2 = \cdots = f_d\) and False
otherwise.
Input Example: For the string "abacbc", the frequencies of characters a, b, and c are each 2, so the answer is True
.
Note: The input is read from standard input (stdin) and the output is written to standard output (stdout).
inputFormat
The input consists of a single line containing a non-empty string s composed of lowercase English letters.
outputFormat
Output a single line with either True
or False
(without quotes) depending on whether all distinct characters in s appear the same number of times.
abacbc
True