#include <iostream>
#include <cstring>
using namespace std;
const int maxn = 10000;
int a[maxn];
int up;
int tot;
int i, j;
string str;
int main()
{
memset(a, 0, sizeof(a));
while(cin >> str, str[0] != '0'){
up = 0;
for(i = 0, j = str.size() -1; i < maxn; i++, j--){
if(j < 0){
a[i] += up;
break;
}
tot = a[i] + (str[j] - '0') + up;
a[i] = tot%10;
up = tot/10;
}
}
for(i = maxn -1; i >= 0; i--){
if(a[i] != 0)
break;
}
for(;i >=0; i--)
cout << a[i];
cout << endl;
return 0;
}
uva 424
最新推荐文章于 2019-05-16 14:15:50 发布