Cod sursa(job #1420291)

Utilizator ButnaruButnaru George Butnaru Data 18 aprilie 2015 09:21:48
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.47 kb
program text1;
var s:ansistring;
    n,i,j,nr:longint;
    f1,f2:text;
begin
assign (f1,'text.in');
assign (f2,'text.out');
reset (f1);
rewrite (f2);
readln (f1,s);
n:=length(s); nr:=0; j:=0; s:=' '+s;
for i:=1 to n-1 do begin
if (not (s[i] in ['a'..'z','A'..'Z'])) and (s[i+1] in ['a'..'z','A'..'Z']) then nr:=nr+1;
if s[i] in ['a'..'z','A'..'Z'] then j:=j+1;
end;
if s[n] in ['a'..'z','A'..'Z'] then j:=j+1;
writeln (f2,j div nr);
close (f1);
close (f2);
end.