|
|
back to boardWhi ACCES VIOLATION. when i send it on online contest i got Ac. var i,j,k,l,m,n:integer; a,sol:array [1..100] of string; b:array [1..100] of integer; sintacs,word_st:string; ch1,ch2:char; function swap(s:string):string; var nn,mm,ww:integer; aa,bb:char; begin nn:=length(s); ww:=nn; for mm:=1 to (nn div 2) do begin bb:=s[mm]; s[mm]:=s[ww]; s[ww]:=bb; dec(ww); end; word_st:=s; end; begin while not (eof) do begin inc (m); while not (eoln) do begin read (ch1); a[m]:=a[m]+ch1; inc (b[m]); end; readln; end; for i:=1 to m do begin for j:=1 to b[i] do begin inc (k); if (a[i][j]<>' ')and(a[i][j]<>',')and(a[i][j]<>'!')and(a[i][j] <>'?')and(a[i][j]<>'"')and(a[i][j]<>':')and(a[i][j]<>'.') then word_st:=word_st+a[i][j] else begin if word_st<>'' then swap(word_st); sol[i]:=sol[i]+word_st+a[i][j]; word_st:=''; end; end; writeln (sol[i]); end; end. |
|
|