Răspuns :
#include <iostream>
#include <cassert>
using namespace std;
int main()
{
int cnt = 0;
int a , b;
cin >> a >> b;
while(a != 0 && b != 0)
{
while(a > 9)
a /= 10;
while(b > 9)
b /= 10;
if(a == b)
cnt ++;
cin >> a >> b;
}
cout << cnt << endl;
return 0;
}
#include <cassert>
using namespace std;
int main()
{
int cnt = 0;
int a , b;
cin >> a >> b;
while(a != 0 && b != 0)
{
while(a > 9)
a /= 10;
while(b > 9)
b /= 10;
if(a == b)
cnt ++;
cin >> a >> b;
}
cout << cnt << endl;
return 0;
}
#include <iostream>
using namespace std;
int x, y, ct, p1, p2;
int main()
{
while(cin >> x >> y)
{
if(x == 0 && y == 0) break;
if(x != 0)
{
while(x / 10)
x = x / 10;
p1 = x;
} else p1 = 0;
if(y != 0)
{
while(y / 10)
y = y / 10;
p2 = y;
} else p2 = 0;
if(p1 == p2) ct++;
}
cout << ct;
return 0;
}
using namespace std;
int x, y, ct, p1, p2;
int main()
{
while(cin >> x >> y)
{
if(x == 0 && y == 0) break;
if(x != 0)
{
while(x / 10)
x = x / 10;
p1 = x;
} else p1 = 0;
if(y != 0)
{
while(y / 10)
y = y / 10;
p2 = y;
} else p2 = 0;
if(p1 == p2) ct++;
}
cout << ct;
return 0;
}