forked from matthewsamuel95/ACM-ICPC-Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheck_Substring.c
More file actions
39 lines (33 loc) · 792 Bytes
/
Check_Substring.c
File metadata and controls
39 lines (33 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#define int long long int
#undef int
int main()
{
#define int long long int
int n, m;
scanf("%d %d", &n, &m);
char s[n], s1[m];
scanf("%s%s", s, s1);
int flag;
for(int i=0; i<=n-m; i++)
{ flag=1;
for(int j=0; j<m; j++)
{
if(s[i+j]!=s1[j])
{
flag=0;
break;
}
}
if(flag==1)
{
printf("yes");
break;
}
}
if(flag==0)
{
printf("no");
}
return 0;
}