Untitled
user_5811307
plain_text
2 years ago
367 B
10
Indexable
#include <iostream>
using namespace std;
#include <string>
int main()
{
long long zer = 0, one = 0, b =0;
while (1)
{
cin >> b;
string a = to_string(b);
if (b == 1) break;
for (long long i = 0; i < a.length(); i++)
{
if (a[i] == '1') one += 1;
else if (a[i] == '0') zer += 1;
}
}
cout << zer << " " << one << endl;
}
Editor is loading...
Leave a Comment