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

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author root
 */
public class ZgukistringZ {

    public static void main(String argsp[]) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String a = in.next();
        String b = in.next();
        String c = in.next();
        int numb = 0;
        int numc = 0;
        Map<Character, Integer> amap = new HashMap<>();
        for (int i = 0; i < a.length(); i++) {
            char ch = a.charAt(i);
            if (amap.containsKey(ch)) {
                amap.put(ch, amap.get(ch) + 1);
            } else {
                amap.put(ch, 1);
            }
        }
        Map<Character, Integer> bmap = new HashMap<>();
        for (int i = 0; i < b.length(); i++) {
            char ch = b.charAt(i);
            if (bmap.containsKey(ch)) {
                bmap.put(ch, bmap.get(ch) + 1);
            } else {
                bmap.put(ch, 1);
            }
        }
        Map<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < c.length(); i++) {
            char ch = c.charAt(i);
            if (cmap.containsKey(ch)) {
                cmap.put(ch, cmap.get(ch) + 1);
            } else {
                cmap.put(ch, 1);
            }
        }
        int minRate = Integer.MAX_VALUE;
        for (Character key : bmap.keySet()) {
            int need = bmap.get(key);
            int num = -1;
            if (amap.containsKey(key)) {
                num = amap.get(key);
            }
            int rate = num / need;
            if (rate < minRate) {
                minRate = rate;
            }
        }
        numb = minRate;
        minRate = Integer.MAX_VALUE;
        for (Character key : cmap.keySet()) {
            int need = cmap.get(key);
            int num = -1;
            if (amap.containsKey(key)) {
                num = amap.get(key);
            }
            int rate = num / need;
            if (rate < minRate) {
                minRate = rate;
            }
        }
        numc = minRate;

        int maxSum = numc;
        int nc = numc;
        int nb = 0;
        for (int i = 0; i < numc; i++) {

        }

        StringBuilder res = new StringBuilder();
        if (numb >= numc) {
            res.append(getZString(amap, numb, b));
            res.append(getZString(amap, numc, c));
        } else {
            res.append(getZString(amap, numc, c));
            res.append(getZString(amap, numb, b));
        }
        for (Character key : amap.keySet()) {
            int num = amap.get(key);
            if (num > 0) {
                for (int i = 0; i < num; i++) {
                    res.append(key);
                }
            }
        }
        System.out.println(res.toString());
    }

    public static String getZString(Map<Character, Integer> amap, int num, String str) {
        StringBuilder res = new StringBuilder();
        int count = 0;
        while (num>=1) {
            boolean ok = true;
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (amap.containsKey(ch) && amap.get(ch) >= num) {
                    amap.put(ch, amap.get(ch) - num);
                } else {
                    ok = false;
                    for (int j = i - 1; j >= 0; j--) {
                        amap.put(str.charAt(j), amap.get(str.charAt(j)) + num);
                    }
                    num--;
                    break;
                }
            }
            if(ok){
                break;
            }
        }
        for (int i = 0; i < num; i++) {
            res.append(str);
        }
        return res.toString();
    }
}
