#include <bits/stdc++.h>
using namespace std;
int main(){
string str;
cin>>str;
int ans = 0;
for(auto x : str){
if(x=='0'||x=='6'||x=='9')ans++;
else if(x=='8') ans += 2;
}
cout<<ans;
return 0;
}
for循环判断,如果当前的字符为'0'or'6'or'9',ans += 1,如果当前字符为'8',ans+=2
#牛客春招刷题训练营#https://www.nowcoder.com/discuss/727521113110073344

京公网安备 11010502036488号