e-olymp
Competitions

Programming Principles 1. Week 2. September 9 - 15. PART 2

Three identical digits

Four-digit number is given. Determine if it contains exactly three identical digits.

Input

One four-digit number.

Output

Print "YES" if number contains exactly three identical digits, and "NO" otherwise.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2322
Output example #1
YES
Input example #2
2234
Output example #2
NO