include stdio include conio include malloc include string int main do

 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <stdio.h>
#include <conio.h>
#include <malloc.h>
#include <string.h>
int main ()
{
do
{
fflush (stdin);
puts ("Vibirite deystvie \n1 - Udalenie slov s ukazannoy bukvoy\n2 - Udalenie soderzhimogo v skobkah");
int z;
scanf ("%d",&z);
switch
{
case 1:
{
fflush (stdin);
char *str, sim[1];
char *word;
str = (char *) calloc (1000, sizeof (char));
puts ("Vvedite stroku");
gets (str);
puts ("Vvedite bukvu");
scanf ("%c",sim);
word = strtok (str," ");
char** words = (char**)calloc(1, sizeof(char*));
int word_count = 0;
while (word != NULL)
{
word_count++;
words = (char**)realloc(words, word_count * sizeof(char*));
bool word_found = false;
for (int j = 1; j < (strlen (word)); j++)
{
if (sim[0]==word[j])
{
word_found = true;
break;
}
}
if(!word_found)
words[word_count - 1] = word;
else
word_count--;
word = strtok(NULL," ");
}
printf("\nposle sortirovki\n");
for(int i = 0; i < word_count; i++)
{
printf("%s ", words[i]);
}
fflush (stdin);
}break;
case 2:
{
fflush (stdin);
puts ("Vvedite stroku:");
char *str;
char *open;
char *close;
str = (char *) calloc (1000,sizeof (char));
gets (str);
int len = strlen (str), counter=0,;
for (int i=0; i<len; i++)
{
if (str[i]==')')
{
for (int k=i; k>0; k--)
{
if (str[k]=='(')
{
for (int j=k; j < i; j++)
{
str[j]=str[j+(i-k)+1];
}
}
}
}
}
printf (str);
}break;
fflush (stdin);
}
puts ("\ndlyy povtora nazhmite lubuyu klavishu. esc - vihod");
}
while (getch()!=27);
}