#C8325. One Digit Replacement
One Digit Replacement
One Digit Replacement
Given a string s consisting of digits ('0'-'9'), determine whether it is possible to make all the digits identical by changing at most one digit.
Formally, let the string s have length n (where \(n \ge 1\)). You are allowed to change exactly one digit (or no digit if the string is already uniform) such that the resulting string has all characters equal.
For example, if \(s = 1112111\), you can change the single differing digit (2) to 1. However, if \(s = 123456\) or \(s = 44545\), more than one change would be necessary.
Output "YES" if it is possible with at most one change; otherwise, output "NO".
inputFormat
The input consists of a single line containing a non-empty string of digits.
For example:
1112111
outputFormat
Output a single line containing either "YES" or "NO" depending on whether all digits can be made identical by changing at most one digit.
## sample888888
YES