Code
#include <iostream>
#include <string>
using namespace std;
int main() {
int T;
cin >> T;
cin.ignore();
while (T--) {
string S;
getline(cin, S);
int totalValue = 0;
for (char ch : S) {
if (isdigit(ch)) {
totalValue += ch - '0';
}
}
cout << totalValue << endl;
}
return 0;
}
Information
- Submit By
- Type
- Pretest
- Problem
- P1072 Valuable digit
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-07-14 16:07:24
- Judged At
- 2024-07-14 16:07:24
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 540.0 KiB