#44224: C++解法


yp11351280@yphs.tp.edu.tw (810-43韓睿哲)


#include<iostream>
using namespace std;
 int main() {
     int L, R;
     while(cin>>L>>R) {
         int c=0;
         for(int i=L; i<=R; i++) {
             int temp=i;
             while(temp!=0) {
                 if(temp%10==2) c++;
                 temp/=10;
             }
        }
         cout<<c<<endl;
     }
 }