TOPIC

Wrong Answer 10%

Gb asked 3 years ago

#include <iostream>
using namespace std;

int main(int argc, char *argv[]) {
    int c;
    int al=0, bl=0;
    string a,b;
    cin>>c;
    for(int i=1;i<=c;i++){
        cin>>a>>b;
        al=a.length();
        bl=b.length();

        if(bl>al || b<a){
            cout<<"nao encaixa"<<endl;
        }
        else if(a[al-1]==b[bl-1]){
            cout<<"encaixa"<<endl;
        }
        else{
            cout<<"nao encaixa"<<endl;
        }
    }
    return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.