题解 | #小红的抛弃后缀#
小红的抛弃后缀
https://ac.nowcoder.com/acm/problem/271172
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { string s; cin>>s; ll len=s.size(); ll num=0; ll res=0; for(ll i=0;i<len;i++) { num=num*10+s[i]-'0'; if(num%9==0) res++; else num=num%9; } cout<<res; return 0; }