Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include<cstring>
- using namespace std;
- ifstream cin("alfanumeric.in");
- ofstream cout("alfanumeric.out");
- int main(){
- int n,sum=0,k=0;char c,s[2000001];
- cin>>n;
- for(int i=0;i<n;i++){
- cin>>c;
- if(c>='0' && c<='9'){ sum+=(int(c)-48); }
- if(c>='a' && c<='z'){ c=toupper(c); }
- if((c>='A' && c<='Z') || (c>='a' && c<='z')){ s[k++]=c; }
- }
- cout<<s<<endl<<sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement