Pagini recente » Cod sursa (job #853209) | Cod sursa (job #1638333) | Cod sursa (job #1059712) | Cod sursa (job #2886630) | Cod sursa (job #1615761)
var
ch,predch:char;
i,j,words,letters,chars:integer;
Begin
assign(input,'text.in'); reset(input);
assign(output,'text.out'); rewrite(output);
read(input,ch);
while not(ch in ['a'..'z','A'..'Z']) do read(input,ch);
letters:=0;
words:=1;
// repeat
while not(eof(input)) do
begin
if ch in ['a'..'z','A'..'Z'] then inc(letters);
if not(ch in ['a'..'z','A'..'Z']) and (predch in ['a'..'z','A'..'Z']) then inc(words);
predch:=ch;
read(ch);
end;
// if eoln(input) then readln(input);
// until eof(input);
if ch in ['a'..'z','A'..'Z'] then inc(letters); if not( ch in ['a'..'z','A'..'Z']) then dec(words);
// writeln(predch,' ',ch);
// writeln(letters,' ',words);
write(output,letters div words);
close(input);
close(output);
end.