for(s=(r=readline)()-1;l=r()+0;)eval('for(;v=/(.{0,'+s+'})[ 0]/g(l);)print(v[1])')