25 lines
378 B
C++
25 lines
378 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
string a;
|
|
cin >> a;
|
|
|
|
int res = 0;
|
|
string output = "";
|
|
|
|
for (int i = a.length() - 1; i >= 0; i--) {
|
|
if ('0' <= a[i] && a[i] <= '9')
|
|
res += (int)(a[i] - '0');
|
|
else
|
|
output += a[i];
|
|
}
|
|
|
|
cout << res << '\n';
|
|
if (output == "")
|
|
cout << -1 << '\n';
|
|
else
|
|
cout << output << '\n';
|
|
}
|