program proga;
var str: array of string;
readstr: string; i, x, err, count: integer;
necheti: array [1..3] of integer; y: boolean;
begin
y := false;
while y = false do begin;
Readln(readstr);
str := readstr.Split(' ');
for i := 1 to Length(str) do begin
Val(str[i - 1], x, err); if (x mod 2 <> 0) and (x < 0) then begin count += 1; if count = 1 then necheti[1] := x; if count = 2 then necheti[2] := x; if count = 3 then necheti[3] := x;
if count = 3 then begin Writeln('1: ', necheti[1]);
Writeln('2: ', necheti[2]);
Writeln('3: ', necheti[3]); y := true; end;
end;
end;
end;
end.
Объяснение:
Вводить значения строго через пробел и без запятых
var
i: integer;
Lett: set of char;
begin
Lett := ['A'..'z', 'А'..'я'];
for i := 1 to Length(s) do
if s[i] in Lett then s[i] := LowCase(s[i])
else s[i] := c
end;
var
s1, s2: string;
begin
write('Введите первую строку: ');
readln(s1);
write('Введите вторую строку: ');
readln(s2);
Replace(s1, '$');
Replace(s2, '_');
writeln(s1);
writeln(s2)
end.
Тестовое решение:
Введите первую строку: Карл у Клары украл кораллы, а Клара у Карла... украла кларнет! 1+2+3+4+5=15 По-моему так!
Введите вторую строку: "Colorless green ideas sleep furiously"/ (Noam Chomsky, 1957).
карл$у$клары$украл$кораллы$$а$клара$у$карлаукрала$кларнетпо$моему$так$
_colorless_green_ideas_sleep_furiouslynoam_chomsky