我的程序如下:
var
wor1:string;
wor2:array[0..100000] of char;
i,l,k:longint;
begin
while not eof do
begin
k:=0;
readln(wor1);
i:=length(wor1);
wor2:=wor1;
for l:=1 to i do begin if wor2[l]=' ' then k:=k+1; if (wor2[l]=' ') and (wor2[l+1]=' ') then k:=k-1;end;
writeln(k+1);
end;
end.
爲什麽WA?提示他的答案是11,我的是12