Cod sursa(job #559677)

Utilizator GhitaRaulGhita Raul GhitaRaul Data 17 martie 2011 23:27:55
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.41 kb
Program text1;
var  f:text;
     n,i,x:integer;
     s:string;
begin
n:=0;
x:=1;
assign(f,'text.in');reset(f);
While not eof(f) do begin
readln(f,s);
n:=n+length(s);
For i:=1 to length(s) do begin
If (s[i]=' ')and((s[i-1] in ['a'..'z'])or(s[i+1] in ['a'..'z'])) then  x:=x+1;
If (s[i]<'A')or(s[i]>'z') then n:=n-1;
end;
    end;
assign(f,'text.out');rewrite(f);
writeln(f,n ,' ', x);
close(f);
end.