Beecrowd 1241
kaziamir
c_cpp
2 years ago
924 B
3
Indexable
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; while(N--){ char A[1005],B[1005]; cin>>A>>B; int lenA = strlen(A), lenB = strlen(B); if(lenA<lenB){ cout<<"nao encaixa"<<endl; } else if(lenA==lenB){ if(strcmp(A,B)==0){ cout<<"encaixa"<<endl; } } else{ int present = 1, m=0; for(int i=0;i<lenA;i++){ if(A[i]==B[0]){ int l = i+1; for(int k=1;k<lenB;k++){ if(B[k]!=A[l]){ present = 0; m=1; break; } l++; } } } (m==1) ? present = 0 : present = 1; } } return 0; }
Editor is loading...