#include <iostream>
using namespace std;
int main()
{
int N, N1, count=0;
cout << "N="; cin >> N;
N1=N;
while (N>=10)
N/=10;
}
while (N1)
if(N1%10==N) count++;
N1/=10;
cout << "count=" << count << "\n";
system("pause");
return 0;
#include <iostream>
using namespace std;
int main()
{
int N, N1, count=0;
cout << "N="; cin >> N;
N1=N;
while (N>=10)
{
N/=10;
}
while (N1)
{
if(N1%10==N) count++;
N1/=10;
}
cout << "count=" << count << "\n";
system("pause");
return 0;
}