Untitled
#include <iostream> #include <cmath> #include <string> #include <vector> using namespace std; int sum(string g) { int gg = 0; for(int i=0; i < g.length();i++) { if(g[i] == '1') { gg++; } } return gg; } int main() { string name; cin >>name; cout <<sum(name); }
Leave a Comment