TITLE:-
Does s contain t ?
PROBLEM:-
Line 1 : String s
Line 2 : String t
true or false
abchjsgsuohhdhyrikkknddg
coding
true
abcde
aeb
false
SOLUTION:-
#include<iostream>
using namespace std;
bool checksequenece(char large[] , char*small) {
if(small[0]=='\0'&&large[0]!='\0')
return true;
else if(small[0]!='\0'&&large[0]=='\0')
return false;
else if(large[0]=='\0'&&small[0]=='\0')
return true;
int i=0;
for(;large[i]!='\0';i++)
{
if(large[i]==small[0])
{
break;
}
}
if(large[i]=='\0')
return false;
return checksequenece(large+i+1,small+1);
}
int main()
{
char large[10000];
char small[10000];
cin>>large;
cin>>small;
bool x=checksequenece(large , small);
if(x)
cout<<"true";
else
cout<<"false";
}
This is dummy text. It is not meant to be read. Accordingly, it is difficult to figure out when to end it. But then, this is dummy text. It is not meant to be read. Period.
If you have any doubts then please let me know... ConversionConversion EmoticonEmoticon