for(;[f,t,n]=readline().split(' ');)print(('abcdefghijklmnopqrstuvwxyz'.match(RegExp(f+'.*'+t))||f)[0].replace(/./g,Array(-~n).join('$&')))