brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo
okat
tako
 aleksandrehteosidatedodam
evo
si
 goodbyeihopecontestisntsohar
oh
god
 duxidimkeetoivas
dd
odi
 hellodeninobrdo
od
hel
 ikbalturkeybelieveinyou
bal
kan
 zdule
didins
meinkraft
 cumurcumur
um
cur
 ikatanictisinajboljiuhrvatskojakoprictasovojaviseakotijedosadno
javise
sine
 zlobobermyfriendandthanksforhelp
de
for
 navijamzaradnickiastabidrugo
druzina
djavola
 saljivdzijasamjaneki
neki
ja
 bumbumdzejsikerol
bumbum
bum
 svetislavgajicpoznatijikaosvetaxxx
slavi
slavu
 princeofpersiayouhavegreatcontestbutinwrongtime
op
pera
 pozdravizamarkamatovicaaleksandracveticainenadaslagalicustanisica
vas
rad
 dreamoonhasonedream
no
no
 jankosustersicneceovoraditi
cosovic
oce
 milenicnikolaitisideotakmicenja
elem
nik
 touristyouaregreatguy
tourist
guy
 lukavpastaakojelukav
a
u
 xxxbbbcccoca
ca
cb
 aaaaaabababaaa
aa
a
 petryouaregoodandyouhavegoodblogs
blog
rega
 lebronnojameslebronprogrammers
je
bro
 mztskopjetisisampiosrcenaterenostaviajdezanaspobedi
mzt
optee
 gukimikazedauradimseminarskidodatnohumorhumor
dp
mrzime
 razredninjegosgrebovicdobarcoveklosbasketas
ne
go
 pozdravzamojeodeljenjeiprofesoreocudabudempetnula
bojan
cao
 damandicnenapravicheckerzeznulibise
man
ker
 pozdravizazenskudecunecuvasodvajatidaseneprotumacipogresno
cao
deco
 egoryouaregoodbutcantsolveeverythinginonehour
eat
your
 lemigazalemiolemilicomzalemljenje
lemi
zlo
 randomusername
umno
umno
 thisiscornercase
youhavetwolongerstrings
ibelivethatyoudontmissit
 oduleodule
xgrizx
ivanstosicprvi
 molimprofesorkuengleskogdamidapetjasamdobarcovekitrudimseiztogaiakosamoperisan
hvala
unapred
 djeneralmilomirstefanovic
radi
nesto
 balsabratepozdravimajudevojku
oj
zdrav
 iwanttothanktomygrandmaheisveryimportantpersoninmylife
thanks
stanka

takotakotakotakotakoaaaaaaaaaaaaaaaaaaaaaabddddddddddddddddddeffffffffffffffffffghhhhhhhhhiiiiiiiiijjjjjloooooooooooooooooppppprrrssssssssssssssssssssstttttttttttuuu
 siaaaaddddeeeehklmnoorstt
 ohohgodabceeeiinnooprsssttty
 odiadeeiikmstuvx
 ododhelbeilnnor
 kanbbeeeeiiikllortuuvyy
 deluz
 umumcurcur
 sinesineaaaaaaaaabccddhiiiiiijjjjjkkkklnooooooooprrssstttttuvvv
 dedeforforaabbehhikllmnnnoprstyz
 druzinaaaaaabcdgiiijkmnorstv
 nekijajajaadiilmssvz
 bumbumdeeijklorsz
 slaviaaaaceegiiijjknoopsstttvvxxxz
 peraperaabcceeeefgghiiiimnnnnoooorrsstttttuuvwy
 vasvasvasradradradaaaaaaaaaaccccceeegiiiiiiikklllmmnnnnoopstttuzz
 nonoaaaddeeehmmorrs
 oceoceaadeiiijknnorrsssttuv
 elemniknikaaaccdeiiiiijlmnoostt
 touristguyguyaaeeorrt
 aaaaauuejkkkllopstvv
 cacbcbcboxxx
 aaaaaaaaaaabbb
 blogregaregaadddehnoooooopstuuvyy
 jebrobroaaeeegllmmmnnnooprrrss
 mztopteeopteeopteeaaaaaabcddiiiiijjkmnnnorrssssssvz
 mrzimeaaaaaddddeghhiiiikkkmmmnnoooorrrsstuuuu
 nenegogoaaaabbbccddeeeiijkklooorrrrsssstvvz
 bojancaoaaddddeeeeeeeefijjllmmnooooppprrrstuuuvzz
 mankeraaabcccddeeeehiiiilnnnprsuvzz
 decodecodecoaaaaaaadeeegiiijkmnnnnooppprrrssssttuuuuvvvzzz
 eateatyouryourbcdeeeeggghhiilnnnnooooorrstuvv
 lemilemilemilemizlozloaaaceegjjmn
 umnoaadeemnrrs
 acceehiinorrssst
 ddeelloouu
 unapredunapredaaaaaaabcddeeeeefgggiiiiiiijkkkkllmmmmmmoooooooooprrrsssssstttvz
 radinestoaceefiijllmmnorv
 ojojzdravaaaabbdeeiklmprstuuv
 stankaaaadeeeefghhiiiiilmmmmnnnnnoooopprrrrstttttvwyyy

import java.util.*;
public class zukiString {

	public static void main(String[] args){
		String a,b,c;
		Scanner sc= new Scanner(System.in);
		a=sc.nextLine();
		b=sc.nextLine();
		c=sc.nextLine();
		int dolz = a.length();
		int[] tA = new int[27];
		int[] tB = new int[27];
		int[] tC = new int[27];
		for(int i=0; i<a.length();i++){
			char tmp = a.charAt(i);
			tA[tmp-'a']++;
		}
		for(int i=0; i<b.length();i++){
			char tmp = b.charAt(i);
			tB[tmp-'a']++;
		}
		for(int i=0; i<c.length();i++){
			char tmp = c.charAt(i);
			tC[tmp-'a']++;
		}
		int stevC = 0;
		int stevB = 0;
		if(c.length() < b.length()){
			
			boolean uredu = true;
			while(uredu){
				int[] temp = tA;
			for(int i=0; i<tC.length;i++){
				if(tA[i]>= tC[i]){
					tA[i]-=tC[i];
				}else{
					uredu = false;
					tA=temp;
					break;
				}
			}
			stevC++;
			}
			stevC--;
			uredu = true;
			while(uredu){
				int[] temp2 = tA;
			for(int i=0; i<tB.length;i++){
				if(tA[i]>= tB[i]){
					tA[i]-=tB[i];
				}else{
					uredu = false;
					tA=temp2;
					break;
				}
			}
			stevB++;
			}
			stevB--;
			
		}else{
			boolean uredu = true;
			while(uredu){
				int[] temp2 = tA;
			for(int i=0; i<tB.length;i++){
				if(tA[i]>= tB[i]){
					tA[i]-=tB[i];
				}else{
					uredu = false;
					tA=temp2;
					break;
				}
			}
			stevB++;
			
			}
			stevB--;
			uredu = true;
			while(uredu){
				int[] temp = tA;
			for(int i=0; i<tC.length;i++){
				if(tA[i]>= tC[i]){
					tA[i]-=tC[i];
				}else{
					uredu = false;
					tA=temp;
					break;
				}
			}
			stevC++;
			}
			stevC--;
		}
	
		
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<stevB;i++){
			sb.append(b);
		}
		for(int i=0; i<stevC;i++){
			sb.append(c);
		}
		for(int i=0; i<27; i++){
			for(int j=0; j<tA[i];j++){
				String tmp = Character.toString((char) (i+'a'));
				sb.append(tmp);
			}
		}
		System.out.println(sb.toString());
	}
}
