#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false), cin.tie(0); typedef long long LL; //const int N=; int main() { IOS string s; cin>>s; int ans=0; for(auto it: s){ if(it=='0'||it=='6'||it=='9') ans++; else if(it=='8') ans+=2; } cout<<ans; return 0; }
if判断是否为那几个字符即可,注意8是+=2, 最后输出答案