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.ArrayList;
import java.util.Scanner;
import java.util.TreeMap;

public class B551_2 {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        String a = scan.nextLine();
        String b = scan.nextLine();
        String c = scan.nextLine();
        ArrayList<Integer> aCountList = new ArrayList<Integer>();
        ArrayList<Integer> bCountList = new ArrayList<Integer>();
        ArrayList<Integer> cCountList = new ArrayList<Integer>();

        for (int i = 0; i < 26; i++) {
            aCountList.add(0);
            bCountList.add(0);
            cCountList.add(0);
        }

        for (int i = 0; i < a.length(); i++) {
            char achar = a.charAt(i);
            int index = achar - 'a';
            aCountList.set(index, aCountList.get(index) + 1);
        }
        for (int i = 0; i < b.length(); i++) {
            char bchar = b.charAt(i);
            int index = bchar - 'a';
            bCountList.set(index, bCountList.get(index) + 1);
        }

        for (int i = 0; i < c.length(); i++) {
            char cchar = c.charAt(i);
            int index = cchar - 'a';
            cCountList.set(index, cCountList.get(index) + 1);
        }

        int bmin = 0;

        for (int i = 0; i < bCountList.size(); i++) {
            int count = bCountList.get(i);
            if (count > 0) {
                int aCharCount = aCountList.get(i);
                if (aCharCount == 0) {
                    bmin = 0;
                    break;
                }
                int temp = aCharCount / count;
                if (temp < bmin || bmin == 0) {
                    bmin = temp;
                }
            }
        }

        if (bmin > 0) {
            for (int i = 0; i < bCountList.size(); i++) {
                int bcharcount = aCountList.get(i) - bmin * bCountList.get(i);
                aCountList.set(i, bcharcount);

            }
        }

        int cmin = 0;

        for (int i = 0; i < cCountList.size(); i++) {
            int count = cCountList.get(i);
            if (count > 0) {
                int aCharCount = aCountList.get(i);
                if (aCharCount == 0) {
                    cmin = 0;
                    break;
                }
                int temp = aCharCount / count;
                if (temp < cmin || cmin == 0) {
                    cmin = temp;
                }
            }
        }

        if (cmin > 0) {
            for (int i = 0; i < cCountList.size(); i++) {
                int ccharcount = aCountList.get(i) - cmin * cCountList.get(i);
                aCountList.set(i, ccharcount);

            }
        }

        StringBuilder rtn = new StringBuilder();
        for (int i = 0; i < bmin; i++) {
            rtn.append(b);
        }
        for (int i = 0; i < cmin; i++) {
            rtn.append(c);
        }
        for (int i = 0; i < aCountList.size(); i++) {
            int count = aCountList.get(i);
            for (int j = 0; j < count; j++) {
                rtn.append((char) ('a' + i));
            }
        }
        System.out.println(rtn);

    }
}
