#include <stdio.h>
int main()
{
char first[10],second[10],third[10];
scanf("%s%s%s",&first,&second,&third);
int count = 0, kount = 0, findex = -1, eindex = -1, flag = 0, chumma = 0;
for(int i=0;i<strlen(first);i++)
{
for(int j=chumma;j<strlen(third);j++)
{
if(first[i] == third[j] && findex < j)
{
count++;
findex = j;
chumma = j;
break;
}
else if (first[i] == third[j] && findex > j)
{
flag = 1;
break;
}
if (flag == 1)
break;
}
}
flag = 0;
chumma = 0;
for(int i=0;i<strlen(second);i++)
{
for(int j=chumma;j<strlen(third);j++)
{
if(second[i] == third[j] && eindex < j)
{
kount++;
eindex = j;
chumma = j;
break;
}
else if (second[i] == third[j] && eindex > j)
{
flag = 1;
break;
}
if (flag == 1)
break;
}
}
if ( count == strlen(first) && kount == strlen(second) )
printf("True");
else
printf("False");
return 0;
}
int main()
{
char first[10],second[10],third[10];
scanf("%s%s%s",&first,&second,&third);
int count = 0, kount = 0, findex = -1, eindex = -1, flag = 0, chumma = 0;
for(int i=0;i<strlen(first);i++)
{
for(int j=chumma;j<strlen(third);j++)
{
if(first[i] == third[j] && findex < j)
{
count++;
findex = j;
chumma = j;
break;
}
else if (first[i] == third[j] && findex > j)
{
flag = 1;
break;
}
if (flag == 1)
break;
}
}
flag = 0;
chumma = 0;
for(int i=0;i<strlen(second);i++)
{
for(int j=chumma;j<strlen(third);j++)
{
if(second[i] == third[j] && eindex < j)
{
kount++;
eindex = j;
chumma = j;
break;
}
else if (second[i] == third[j] && eindex > j)
{
flag = 1;
break;
}
if (flag == 1)
break;
}
}
if ( count == strlen(first) && kount == strlen(second) )
printf("True");
else
printf("False");
return 0;
}
No comments:
Post a Comment