Skip to content

Commit 71553ca

Browse files
Merge pull request #250 from Manish17292000/patch-3
Create Checking substring
2 parents 05dd9a9 + 4990e5c commit 71553ca

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

String/substring/Checkingsubstring.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<stdio.h>
2+
int main()
3+
{ int n, m;
4+
scanf("%d %d", &n, &m);
5+
char s[n], s1[m];
6+
scanf("%s%s", s, s1);
7+
int flag;
8+
for(int i=0; i<=n-m; i++)
9+
{ flag=1;
10+
for(int j=0; j<m; j++)
11+
{
12+
if(s[i+j]!=s1[j])
13+
{
14+
flag=0;
15+
break;
16+
}
17+
}
18+
19+
if(flag==1)
20+
{
21+
printf("yes");
22+
break;
23+
}
24+
}
25+
if(flag==0)
26+
{
27+
printf("no");
28+
}
29+
30+
}

0 commit comments

Comments
 (0)