Cod sursa(job #175137)

Utilizator llobyLodoaba Mihai lloby Data 9 aprilie 2008 16:57:18
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.76 kb
Program texte;
var s: string;
    nc,nt,q,i: longint;
    t,f: text;
Begin
    assign(t,'text.in'); reset(t);
    read(t,s);
    close(t);
    nc:=0;
    nt:=0;
    q:=0;
    for i:=1 to length(s) do
      begin
         if s[i] in ['a'..'z']+['A'..'Z'] then begin
                                   q:=1;
                                   nt:=nt+1;
                                end
                    else if q<>0 then
                        begin
                            nc:=nc+1;
                            q:=0;
                        end;
      end;
    if s[length(s)] in ['a'..'z']+['A'..'Z'] then nc:=nc+1;
    if (q=1) and (nc=0) then nc:=nc+1;
    assign(f,'text.out'); rewrite(f);
    write(f,nt div nc);
    close(f);
end.