Попробуй Program PascalGuru; var s:string; f,t:text; function preobr(s:string):string;var i,j,p,n,sered:integer; gl,zp,slovo:string; m:array [1..80] of string;beginzp:='!?*,.'; gl:='аоуыэяеёюи'; p:=pos(' ',s); i:=0; repeat inc(i); slovo:=copy(s,1,p-1); m[i]:=slovo; delete(s,1,p); p:=pos(' ',s); until p=0; n:=i+1; m[n]:=s; for i:=1 to n do begin s:=m[i]; if pos(s[length(s)],zp)<>0 then p:=length(s)-1 else p:=length(s); sered:=(p div 2)+1; if (not odd(p)) or (p<3) then continue; if pos(s[1],gl)=0 then continue; if pos(s[sered],gl)=0 then continue; if pos(s[p],gl)=0 then continue; s[1]:=UpCase(s[1]); s[sered]:=UpCase(s[sered]); s[p]:=UpCase(s[p]); m[i]:=s+'('+s[1]+','+s[sered]+','+s[p]+')'; end; s:=''; for i:=1 to n do s:=s+m[i]+' '; preobr:=s;end; beginassign(f,'input.txt'); reset(f);assign(t,'output.txt'); rewrite(t); while not eof(f) do begin readln(f,s); writeln(t, preobr(s) ); end; writeln('Файл успешно записан...'); close(f);close(t);readln;end.
Var f:text; s:string; i,slo,ks:integer; k:real; begin assign(f,'text.in'); reset(f); while not Eof(f) do read(f,s); close(f); slo:=0; ks:=0; for i:=1 to length(s) do if s[i] in t then inc(slo) else begin; k:=k+slo; inc(ks); slo:=0; end; if s[length(s)] in t then begin; inc(ks); k:=k+slo; end; k:=k/ks; assign(f,'text.out'); rewrite(f); write(f,k); close(f); end.
Пример ввода(text.in): SIMPLE text Пример вывода(text.out): 5
function preobr(s:string):string;var i,j,p,n,sered:integer; gl,zp,slovo:string; m:array [1..80] of string;beginzp:='!?*,.'; gl:='аоуыэяеёюи'; p:=pos(' ',s); i:=0; repeat inc(i); slovo:=copy(s,1,p-1); m[i]:=slovo; delete(s,1,p); p:=pos(' ',s); until p=0; n:=i+1; m[n]:=s; for i:=1 to n do begin s:=m[i]; if pos(s[length(s)],zp)<>0 then p:=length(s)-1 else p:=length(s); sered:=(p div 2)+1; if (not odd(p)) or (p<3) then continue; if pos(s[1],gl)=0 then continue; if pos(s[sered],gl)=0 then continue; if pos(s[p],gl)=0 then continue; s[1]:=UpCase(s[1]); s[sered]:=UpCase(s[sered]); s[p]:=UpCase(s[p]); m[i]:=s+'('+s[1]+','+s[sered]+','+s[p]+')'; end; s:=''; for i:=1 to n do s:=s+m[i]+' '; preobr:=s;end;
beginassign(f,'input.txt'); reset(f);assign(t,'output.txt'); rewrite(t); while not eof(f) do begin readln(f,s); writeln(t, preobr(s) ); end; writeln('Файл успешно записан...'); close(f);close(t);readln;end.
type
ty=set of char;
Const
t:ty=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
Var
f:text;
s:string;
i,slo,ks:integer;
k:real;
begin
assign(f,'text.in');
reset(f);
while not Eof(f) do read(f,s);
close(f);
slo:=0;
ks:=0;
for i:=1 to length(s) do
if s[i] in t then inc(slo) else
begin;
k:=k+slo;
inc(ks);
slo:=0;
end;
if s[length(s)] in t then
begin;
inc(ks);
k:=k+slo;
end;
k:=k/ks;
assign(f,'text.out');
rewrite(f);
write(f,k);
close(f);
end.
Пример ввода(text.in):
SIMPLE text
Пример вывода(text.out):
5