@KATbIK
86 / 81 / 10
Регистрация: 02.08.2011
Сообщений: 335
|
22.03.2012, 20:29
|
|
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
| #include <stdio.h>
#include <string.h>
int main()
{
char* text = "The quick brown fox jumbeps over the labzy dog ";
char symbol[1], buf[256], result[256];
int number = 0, max = 0;
printf("Enter symbol\n");
scanf("%c",&symbol);
for(int i = 0, n = 0, e = strlen(text); i < e; ++i)
{
if(text[i] != ' ' && ((i + 1) < e))
{
if(text[i] == symbol[0])
{
++number;
}
buf[n] = text[i];
++n;
} else
{
if(max < number)
{
buf[n] = '\0';
max = number;
strcpy (result, buf);
}
number = 0;
n = 0;
}
}
printf("\nWord: %s ", &result);
return 0;
} |
|
0
|