Untitled
user_5811307
plain_text
2 years ago
334 B
4
Indexable
#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);
}
Editor is loading...
Leave a Comment