word of lowercase English letters. You must delete exactly one letter from it; leaving the string untouched is not allowed.
Can you pick that letter so that every letter still present in the string appears the same number of times? Letters that no longer occur are ignored.
Return true if it can be done and false otherwise.word='xxyyz' → True
Removing an x gives "xyyz" with counts 1, 2 and 1, which does not work. Removing the z leaves "xxyy", where both letters appear twice.
word='ppqq' → False
Whichever letter goes, one letter ends up appearing once and the other twice.
word='kkkk' → True
After removing one k only a single kind of letter is left, so there is nothing for its count to differ from.
word.length ≤ 100word consists of lowercase English letters onlyword='xxyyz'
True
Run checks the first 3 tests in your browser. Submit checks all 76 tests on the server, hidden ones included.