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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map.Entry;

public class B {

	final public static void main( String[] args ) throws Exception {
		BufferedReader f = new BufferedReader( new InputStreamReader( System.in ) );

		String in = f.readLine();
		String one = f.readLine();
		String two = f.readLine();
		if ( one.length() > two.length() ) {
			String tmp = one;
			one = two;
			two = tmp;
		}
		
		HashMap< Character , Integer > inAmounts = new HashMap< Character , Integer >();
		fill0s( inAmounts );
		for ( char i : in.toCharArray() ) {
			if ( inAmounts.get( i ) == null ) {
				inAmounts.put( i , 0 );
			}
			inAmounts.put( i , inAmounts.get( i ) + 1 );
		}
		
		HashMap< Character , Integer > oneAmounts = new HashMap< Character , Integer >();
		fill0s( oneAmounts );
		for ( char i : one.toCharArray() ) {
			oneAmounts.put( i , oneAmounts.get( i ) + 1 );
		}
		
		StringBuilder output = new StringBuilder( "" );
		while( true ) {
			boolean ok = true;
			for ( Entry< Character , Integer > e : oneAmounts.entrySet() ) {
				if ( inAmounts.get( e.getKey() ) < e.getValue() ) {
					ok = false;
				}
			}
			if ( ok ) {
				output.append( one );
				for ( Entry< Character , Integer > e : oneAmounts.entrySet() ) {
					inAmounts.put( e.getKey() , inAmounts.get( e.getKey() ) - e.getValue() );
				}
			}
			else {
				break;
			}
			
		}
		
		HashMap< Character , Integer > twoAmounts = new HashMap< Character , Integer >();
		fill0s( twoAmounts );
		for ( char i : two.toCharArray() ) {
			twoAmounts.put( i , twoAmounts.get( i ) + 1 );
		}
		
		while( true ) {
			boolean ok = true;
			for ( Entry< Character , Integer > e : twoAmounts.entrySet() ) {
				if ( inAmounts.get( e.getKey() ) < e.getValue() ) {
					ok = false;
				}
			}
			if ( ok ) {
				output.append( two );
				for ( Entry< Character , Integer > e : twoAmounts.entrySet() ) {
					inAmounts.put( e.getKey() , inAmounts.get( e.getKey() ) - e.getValue() );
				}
			}
			else {
				break;
			}
			
		}
		
		for ( Entry< Character , Integer > e : inAmounts.entrySet() ) {
			append( output , e.getKey() , e.getValue() );
		}
		
		System.out.println( output );
		f.close();
	}
	
	static void fill0s( HashMap< Character , Integer > map ) {
		for ( int i=0 ; i<=26 ; ++i ) {
			map.put( (char) ('a' + i) , 0 );
		}
	}
	
	static void append( StringBuilder b , char c , int amount ) {
		for ( int i=0 ; i<amount ; ++i ) {
			b.append( c );
		}
	}
}

