#include <iostream>
using namespace std;
int main()
{
int n, num = 1;
cin >> n;
int cn = n;
while (n != 0)
{
int c = n % 10;
if (num % 2 == 0)
{
cout << c << " ";
}
num++;
n /= 10;
}
num = 1;
cout << endl;
while (cn != 0)
{
int c = cn % 10;
if (num % 2 != 0)
{
cout << c << " ";
}
num++;
cn /= 10;
}
return 0;
}