Pagini recente » Cod sursa (job #2747639) | Cod sursa (job #2956065) | Cod sursa (job #2133245) | Cod sursa (job #159850) | Cod sursa (job #1817004)
Program Textual;
VAR
f,g : Text;
s, Aux : String;
Nr_Words,Nr_Letters,i : Integer;
BEGIN
Assign(f,'text.in'); Reset(f);
While Not(EoLn(f)) do
Read(f,s);
Aux := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
For i:=1 to Length(s)-1 do
begin
If ((s[i] = ' ') or (s[i] = '-')) and (pos(s[i+1],Aux) > 0) then Inc(Nr_Words);
If pos(s[i],Aux) > 0 then Inc(Nr_Letters);
end;
Assign(g,'text.out'); Rewrite(g);
Write(g,Nr_Letters div Nr_Words);
Close(f); Close(g);
END.