Skip to content

Commit 0c1a856

Browse files
authored
Create Check_Substring.c
Used C Language
1 parent 71553ca commit 0c1a856

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

String/Substring/Check_Substring.c

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

0 commit comments

Comments
 (0)