|
|
вернуться в форумOk... another wrong answer... can someone test my program along with his/hers and tell me what's wrong... thnx inadvance program timus_p1038; var c:char; n:word; mistakes:word; newphrase:boolean; insideword:boolean; function up(c:char):boolean; begin up:=(c in ['A'..'Z']); end; function sign(c:char):boolean; begin sign:=(pos(c,'.,;:-!?'#13#10)<>0); end; function letter(c:char):boolean; begin letter:=(upcase(c) in ['A'..'Z','0'..'9']); end; function space(c:char):boolean; begin space:=(c=' '); end; function digit(c:char):boolean; begin digit:=(c in ['0'..'9']); end; begin mistakes:=0; newphrase:=true; insideword:=false; while not eof do begin if eoln then begin readln; insideword:=false; end; read(c); if space(c) then insideword:=false; while not(eof)and(space(c))do read(c); if eof then break; if (newphrase)and(not up(c))and(letter(c))and(not(digit(c))) then inc(mistakes); if up(c) and insideword then inc(mistakes); if sign(c) then begin newphrase:=true; insideword:=false; end; if letter(c) then begin insideword:=true; newphrase:=false; end; end; writeln(mistakes); end. |
|
|