Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
585 B
1
Indexable
Never
#include <iostream>
#include <string>

using namespace std;

int main(){
    freopen("BAI3.INP","r",stdin);
    freopen("BAI3.OUT","w",stdout);
    string s;
    getline(cin, s);
    cin.ignore();
    
    int n = 0, sum = 0;
    string ans = "";
    for(int i = 0; i < s.size(); i++){
        if(s[i] >= 48 && s[i] <= 57){
            ++n;
            sum += s[i] - '0';
        }
        else if((s[i] >= 65 && s[i] <= 90) || (s[i] >= 97 && s[i] <= 122))
            ans = ans + s[i];
    }
    cout << n << endl << sum << endl << ans << endl;
    return 0;
}
Leave a Comment