Why WA?!
Maybe I did not understand my task right?!
Here is my program:
program p1164;
var
n,m,p : integer;
a : array['A'..'Z'] of integer;
i : integer;
j : integer;
ch : char;
begin
fillchar(a,sizeof(a),0);
readln(n,m,p);
for i:=1 to n do
begin
for j:=1 to m-1 do
begin
read(ch);
inc(a[ch]);
end;
readln(ch);
inc(a[ch]);
end;
for i:=1 to p do
begin
for j:=1 to m-1 do
begin
read(ch);
dec(a[ch]);
end;
readln(ch);
dec(a[ch]);
end;
for ch:='A' to 'Z' do
begin
for i:=1 to a[ch] do Write(ch);
end;
writeln;
end.
the lengths of words to fill are not fixed to m
> Maybe I did not understand my task right?!
> Here is my program:
>
> program p1164;
> var
> n,m,p : integer;
> a : array['A'..'Z'] of integer;
> i : integer;
> j : integer;
> ch : char;
> begin
> fillchar(a,sizeof(a),0);
> readln(n,m,p);
> for i:=1 to n do
> begin
> for j:=1 to m-1 do
> begin
> read(ch);
> inc(a[ch]);
> end;
> readln(ch);
> inc(a[ch]);
> end;
> for i:=1 to p do
> begin
> for j:=1 to m-1 do
> begin
> read(ch);
> dec(a[ch]);
> end;
> readln(ch);
> dec(a[ch]);
> end;
>
> for ch:='A' to 'Z' do
> begin
> for i:=1 to a[ch] do Write(ch);
> end;
> writeln;
> end.