#include <bits/stdc++.h>
using namespace std;
string st;
int d,i;
int main()
{
getline(cin,st);
d=st.length();
for (i=0; i<d; i++)
if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<st[i]<<" ";
cout<<endl;
for (i=0; i<=d-1; i++)
if ((int(st[i])>=48) and (int(st[i])<=57)) cout<<i<<" ";
return 0;
}