n,c,i:integer; s,s1:string; a:array [1..1000] of string; b:boolean; BEGIN Assign(input,'input.txt'); reset(input); Assign(output,'output.txt'); rewrite(output); READLN(input,n); b:=true; c:=0; WHILE n<>0 do
BEGIN Readln(input,s); WHILE s[1]<>'.' do delete(s,1,1); delete(s,1,1); s1:=Copy(s,1,pos('.',s)-1);
FOR i:=1 to c do IF a[i]=s1 then begin b:=false; break; end; IF b then begin inc(c); a[c]:=s1; End;
b:=true; dec(n); End;
WRITELN(output,c); FOR i:=1 to c do writeln(output,a[i]);
Задачка из олимпиады) Простенькая вроде программулька
var n,i,k,j,f:integer; m:array [1..100] of string; p:array[1..100] of string; sl,por:string; b:boolean; f1,f2:text; begin assign(f1, 'input.txt'); reset(f1); readln(f1,n); for i:=1 to n do readln(f1,m[i]); close (f1);
k:=0; for i:=1 to n do begin por:=''; b:=false; sl:=m[i]; for j:=1 to length(sl) do begin if (Ord(sl[j])>=48) and (Ord(sl[j])<=57) then por:=por+sl[j]; end; for f:=1 to k do begin if por=p[f] then b:=true; end; if b=false then begin k:=k+1; p[k]:=por; end; end; assign(f2, 'output.txt'); rewrite(f2); writeln (f2,k); for i:=1 to k do writeln (f2,p[i]); close (f2); end.
PROGRAM_PORT;
VAR
n,c,i:integer;
s,s1:string;
a:array [1..1000] of string;
b:boolean;
BEGIN
Assign(input,'input.txt'); reset(input);
Assign(output,'output.txt'); rewrite(output);
READLN(input,n);
b:=true;
c:=0;
WHILE n<>0 do
BEGIN
Readln(input,s);
WHILE s[1]<>'.' do delete(s,1,1);
delete(s,1,1);
s1:=Copy(s,1,pos('.',s)-1);
FOR i:=1 to c do
IF a[i]=s1 then begin
b:=false;
break;
end;
IF b then begin
inc(c);
a[c]:=s1;
End;
b:=true;
dec(n);
End;
WRITELN(output,c);
FOR i:=1 to c do writeln(output,a[i]);
Close(input);
Close(output);
END.
Задачка из олимпиады) Простенькая вроде программулька
var
n,i,k,j,f:integer;
m:array [1..100] of string;
p:array[1..100] of string;
sl,por:string;
b:boolean;
f1,f2:text;
begin
assign(f1, 'input.txt');
reset(f1);
readln(f1,n);
for i:=1 to n do
readln(f1,m[i]);
close (f1);
k:=0;
for i:=1 to n do begin
por:='';
b:=false;
sl:=m[i];
for j:=1 to length(sl) do begin
if (Ord(sl[j])>=48) and (Ord(sl[j])<=57) then
por:=por+sl[j];
end;
for f:=1 to k do begin
if por=p[f] then
b:=true;
end;
if b=false then begin
k:=k+1;
p[k]:=por;
end;
end;
assign(f2, 'output.txt');
rewrite(f2);
writeln (f2,k);
for i:=1 to k do
writeln (f2,p[i]);
close (f2);
end.