Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string input, buscar;
- bool si=false;
- int cant;
- cin>>input>>buscar;
- if(input.size()>buscar.size())
- cant=input.size()-buscar.size()+1;
- else
- cant=buscar.size()-input.size()+1;
- for(int cont=0; cont<cant; cont++)
- {
- string comparar;
- for(int cont2=cont, cont3=0; cont3<buscar.size(); cont2++, cont3++)
- {
- comparar += input[cont2];
- }
- if(si==false && comparar == buscar)
- si=true;
- }
- if(si==true) cout<<"SI";
- else cout<<"NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment