#include<bits/stdc++.h>
#define ll long long
#define be begin()
#define ed end()
using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    //freopen("CAU1.INP", "r", stdin);
    //freopen("CAU1.OUT", "w", stduot);

    string s; cin >> s;

    for(int i=0; i<s.size(); i++){
        if(!isdigit(s[i])) s[i] = ' ';
    }
    // lay max
    vector<ll>sz;
    stringstream ss(s);
    string digit;
    bool ok = 0;
    ll MAX = -1e5;
    while(ss >> digit){
        sz.push_back(digit.size());
    }
    for(auto it : sz){
        if(it > MAX) MAX = it;
    }
    vector<string>ans;
    stringstream sss(s);
    string digit1;
    while(sss >> digit1){
        if(digit1.size() == MAX){
            ok = 1; ans.push_back(digit1);
            cout << digit1;
            break;
        }
    }
    cout << "\n";
    ll sum = 0;
    for(auto it : ans){
        ll temp = stoll(it);
        while(temp > 0){
            ll digit = temp % 10;
            sum+=digit;
            temp /= 10;
        }
    }
    cout << sum;
    if(!ok) cout << "\n" << 0;

    return 0;
}
