不论怎么分割 都是在与最后一位数相加 只需要判断当前切割到的左边数字和字符串尾部数字相加是否为偶数

#include <iostream>
using namespace std;

int main() {
    string s;
    cin >> s;
    int last = s.back();
    s.pop_back();
    int cnt = 0;
    for(char c : s){
        if((c - '0' + last) % 2 == 0) cnt ++;
    }
    cout << cnt;
}