• #include <iostream>
    using namespace std;
    int main()
    {
        char c1,c2,c3,c4,c5,c6,c7,c8;
        int d1,d2,d3;
        int t1,t2,t3,t4,t5,t6,t7,t8,st,et,ft,br1=0,br2=0,m=3;
    
        cin>>c1>>c2>>c3>>c4>>c5>>c6>>c7>>c8;
        t1=c1-48;
        t2=c2-48;
        t3=c3-48;
        t4=c4-48;
        t5=c5-48;
        t6=c6-48;
        t7=c7-48;
        t8=c8-48;
    
        st=(t1*10+t2)*60+(t3*10+t4);
        et=(t5*10+t6)*60+(t7*10+t8);
        if (et<st) et=et+24*60;
        ft=et-st;
        cout<<ft/60<<" "<<ft%60<<endl;
    
        cin>>c1;
        if (c1=='#') c2=c1;
        else cin>>c2;
        if (c1>='A' && c1<='Z') br1++;
        if (c2>='A' && c2<='Z') br1++;
        if (c2>='a' && c2<='z') {br2++; br1--;}
        if (c2>='0'&&c2<='9') {d2=c2-48;br1=br1+d2;}
        if (c2=='#') c3=c2;
        else cin>>c3;
        //cout<<m<<" "<<br1<<" "<<br2<<endl;
    
    
        while(c3!='#')
        {
                if (c3>='a' && c3<='z') {br2++; br1--;}
                if (c3>='A' && c3<='Z') br1++;
                if (c3>='0' && c3<='9')
                {
                    if (c2>='a' && c2<='z') {d3=c3-48; br2=br2+d3-1; }
                    if (c2>='A' && c2<='Z') {d3=c3-48; br1=br1+d3-1;}
                    if (c2>='0' && c2<='9')
                    {
                        if (c1>='a' && c1<='z') {d3=c3-48; d2=c2-48; br2=br2-d2+d2*10+d3;}
                        else {d3=c3-48; d2=c2-48; br1=br1-d2+d2*10+d3;}
                    }
                }
               // cout<<m<<" "<<br1<<" "<<br2<<endl;
                m++;
                c1=c2;
                c2=c3;
                cin>>c3;
    
        }
    
        cout<<br1<<" "<<br2<<endl;
        return 0;
    }
    
  • Вашият коментар

    Вашият имейл адрес няма да бъде публикуван.