17 lines
194 B
C++
17 lines
194 B
C++
|
|
#include<bits/stdc++.h>
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
int n=0,ans=0;
|
||
|
|
cin >>n;
|
||
|
|
int tmp=n;
|
||
|
|
while(tmp>=1) {
|
||
|
|
if(tmp%10==2) ans++;
|
||
|
|
tmp/=10;
|
||
|
|
}
|
||
|
|
cout<<ans;
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
|