code:
#include <bits/stdc++.h> using namespace std; int l,r,i,j,k; int two(int n){ int kkk;int s; while(n){ kkk=n%10; n/=10; if(kkk==2)s++; } return s; } int main() { cin>>l>>r; for(int i=l;i<=r;i++){ j+=two(i); } cout<<j; return 0; }