ac1038.pas

来自「Ural(Acm.timus.ru)题解 By Maigo大牛」· PAS 代码 · 共 32 行

PAS
32
字号
program ural1038;
var
  c:char;
  sen,wor:boolean;
  mis:integer;
function cap(c:char):boolean;
  begin
    if (c>='A') and (c<='Z') then cap:=true else cap:=false;
  end;
function small(c:char):boolean;
  begin
    if (c>='a') and (c<='z') then small:=true else small:=false;
  end;
begin
  sen:=false;wor:=false;mis:=0;
  repeat
    read(c);
    if c<' ' then begin
      wor:=false;
      continue;
    end;
    if (not sen) and small(c) then inc(mis);
    if wor and cap(c) then inc(mis);
    if (c='.') or (c='!') or (c='?') then
      sen:=false
    else if cap(c) or small(c) then
      sen:=true;
    if cap(c) or small(c) then wor:=true else wor:=false;
  until eof;
  writeln(mis);
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?