#55266: cpp_answer


yp11451202@yphs.tp.edu.tw (705-38黃鈺潤)


#include <iostream>
#include <string>

using namespace std;

int main() {
    string n;
    // 使用 while 處理多組數據,直到讀到檔案結尾 (EOF)
    while (cin >> n) {
        long long sum = 0;
        
        // 遍歷字串中的每個字元
        for (char c : n) {
            // 如果字元是數字,則將其加到總和中
            if (isdigit(c)) {
                sum += (c - '0');
            }
            // 可選:sum %= 3; // 保持 sum 較小,避免極端情況下的溢位
        }

        // 判斷總和是否能被 3 整除
        if (sum % 3 == 0) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}