Untitled
unknown
pascal
4 years ago
759 B
8
Indexable
uses crt; var x,y,s:ansistring; i,j:longint; check:array[0..9] of boolean; t:char; begin clrscr; readln(x); readln(y); for i:=1 to length(x) do check[ord(x[i])-48]:=true; for i:=1 to length(y) do if check[ord(y[i])-48]=true then s:=s+y[i]; for i:=1 to length(s) do for j:=i+1 to length(s) do if s[i]<s[j] then begin t:=s[i]; s[i]:=s[j]; s[j]:=t; end; if s[1]='0' then write('0') else begin s:=s+'*'; for i:=2 to length(s) do if s[i]<>s[i-1] then write(s[i-1]); end; readln end.
Editor is loading...