Accepted
Code
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int sum=0;
string str;
cin>>str;
for(int i=0;i<str.length();i++){
if(str[i]>='0'&&str[i]<='9'){
sum+=int(str[i])-48;
}
}
cout<<sum<<endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1072 Valuable digit
- Contest
- Brain Booster #4
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-07-14 16:31:58
- Judged At
- 2024-11-11 03:24:04
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 356.0 KiB