#K66282. Rearranged Divisibility Check
Rearranged Divisibility Check
Rearranged Divisibility Check
You are given a string S consisting of digits. Your task is to determine if the digits of S can be rearranged to form a number that is divisible by 3.
Recall that a number is divisible by 3 if the sum of its digits satisfies the condition $$\sum_{i=1}^{n}d_i \equiv 0 \pmod{3}$$.
Input is read from stdin
and the answer should be printed to stdout
as either YES
or NO
.
inputFormat
A single non-empty string S containing only digits (0-9) is given as input from stdin
.
outputFormat
Output a single line containing YES
if the digits of S can be rearranged to form a number divisible by 3, otherwise output NO
. The output should be printed to stdout
.## sample
0123
YES