Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Task2;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- const
- VOWELS = ['а', 'о', 'у', 'ы', 'э', 'я', 'ю', 'и', 'е'];
- type
- TSet = Set of Char;
- var
- res: TSet;
- str: AnsiString;
- i: Integer;
- function GetOtherVowels(str: AnsiString; i: Integer): TSet;
- var
- j: Integer;
- res: TSet;
- begin
- res := [];
- for j := i to Length(str) do
- if str[j] in VOWELS then
- res := res + [str[j]];
- GetOtherVowels := res;
- end;
- // строка // начало строки
- function GetWord(str: AnsiString; i: Integer): AnsiString;
- var
- res: AnsiString;
- begin
- res := '';
- while (str[i] <> ',') and (str[i] <> '.') do
- begin
- res := res + str[i];
- Inc(i);
- end;
- GetWord := res;
- end;
- function GetVowelsFromWord(word: AnsiString): TSet;
- var
- i: Integer;
- res: TSet;
- begin
- res := [];
- for i := 1 to Length(word) do
- if word[i] in VOWELS then
- res := res + [word[i]];
- GetVowelsFromWord := res;
- end;
- procedure GetResultSet(var resSet: TSet; str: AnsiString);
- var
- i: Integer;
- word: AnsiString;
- begin
- resSet := [];
- i := 0;
- repeat
- Inc(i);
- word := GetWord(str, i);
- resSet := resSet + (GetVowelsFromWord(word) * GetOtherVowels(str, i + Length(word)));
- Inc(i, Length(word));
- until str[i] = '.';
- end;
- procedure PrintSet(x: TSet);
- var
- i: AnsiChar;
- begin
- for i := 'а' to 'я' do
- if i in x then
- Write(i, ' ');
- end;
- begin
- Readln(str);
- GetResultSet(res, str);
- PrintSet(res);
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement