fork(2) download
  1. #include <cctype>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char sum='0';
  8. for(char ch=0;isdigit(ch=cin.get());) if((sum+=ch-'0')>'9') sum-=9;
  9. cout<<sum<<endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 3300KB
stdin
231476231946230184623794679238168492139846213896498032174892374902374892348932614973264702316473216094632189046321640392186490321643164109327648930126412836403216403261479012364321746032164723146238976432894632189463291784692146321789463219846932871649823131
stdout
4