-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinput.txt
More file actions
67 lines (36 loc) · 868 Bytes
/
Copy pathinput.txt
File metadata and controls
67 lines (36 loc) · 868 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char str[100],word[30];
int i,j,found,slen,wlen,index;
printf("Enter the String: ");
gets(str);
printf("Enter the Word: ");
gets(word);
slen=strlen(str);
wlen=strlen(word);
index=-1;
for(i = 0; i < slen; i++){
found = 1;
for(j = 0; j < wlen; j++){
if(str[ i + j ] != word[j]){
found = 0;
break;
}
}
if(str[i + j] != ' ' && str[i + j] != '\t' && str[i + j] != '\n' && str[i + j] != '\0')
{
found = 0;
}
if(found == 1){
for(j=i;j<=slen-wlen;j++){
str[j]=str[j+wlen];
}
}
}
printf("String after removing '%s': \n%s", word, str);
}
//krishno
/*abc*/