//* Problem  : 1530 - Crypto Columns
//* Contest  : acm.tju.edu.cn
//* Type     : Solution
//* Date     : 2007.07.31
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

char s[110];
char key[15];
int len, klen;

int get_index()
{
	int res = 1000, ires, i;
	for (i = 0; key[i]; i++)
		if (key[i] < res) {res = key[i]; ires = i;}
	key[ires] = 127;
	return ires;
}

char a[101][101];

int main()
{
	int n, i, ress;
	while (scanf("%s %s", key, s) == 2 && key[0])
	{
		memset(a, 0, sizeof(a));
		klen = strlen(key); len = strlen(s);
		int collen = len/klen;
		///
		i = 0;
		for (int it = 1; it <= klen; it++)
		{
			int icol = get_index();
			for (int j = 0; j < collen; j++, i++)
				a[j][icol] = s[i];
		}
		for (i = 0; i < collen; i++)
			printf("%s", a[i]);
		putchar('\n');
	}
}