-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathlstepany.c
68 lines (63 loc) · 1.05 KB
/
lstepany.c
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
67
68
#include <stdio.h>
int ei_i(char *str)
{
int i;
int j;
j = 0;
i = 0;
while(str[i] != '\n')
{
if(((str[i] == 'e') || (str[i] == 'E')) && ((str[i+1] == 'i') || (str[i+1] == 'I')))
{
j = i + 1;
}
i++;
}
return(j);
}
int ie_i(char *str)
{
int i;
int j;
i = 0;
j = 0;
while(str[i] != '\n')
{
if((str[i] == 'i' || str[i] == 'I') && (str[i+1] == 'e' || str[i+1] == 'E'))
{
j = i + 1;
}
i++;
}
return(j);
}
int ft_ie_except_after_c(char *str)
{
int ei;
int ie;
ei = ei_i(str);
ie = ie_i(str);
if ((ei == 0) && (ie == 0))
return(1);
if ((ei != 0) && (ie != 0))
{
if(((str[ei - 2] == 'c') || (str[ei - 2] == 'C')) && ((str[ie - 2] != 'c') || (str[ie - 2] != 'C')))
return(1);
else
return(0);
}
if ((ei != 0) && (ie == 0))
{
if ((str[ei - 2] == 'c') || (str[ei - 2] == 'C'))
return(1);
else
return(0);
}
if ((ei == 0) && (ie != 0))
{
if((str[ie - 2] == 'c') || (str[ie - 2] == 'C'))
return(0);
else
return(1);
}
}