#include#include using namespace std;int main(){ string n; while(cin>>n,n!="0"){ int s=0,l=n.length(); for(int i=0;i 9) s=s/10+s%10; cout< <
#include <iostream>
#include <string>using namespace std;int main(){ string n; while(cin>>n,n!="0"){ int s=0,l=n.length(); for(int i=0;i<l;i++) s+=n[i]-'0'; while(s>9) s=s/10+s%10; cout<<s<<endl;}return 0;}