#include<bits/stdc++.h>
using namespace std;
int main(){
  char a[100];
  int c[26]={0};
  int i;
  gets(a);
  for(i=0;i<strlen(a)-1;i++) c[a[i]-'a']++;
  for(i=0;i<26;i++)
  if(c[i]>0) cout<<char('a'+i);
  cout<<endl;
  for(i=0;i<26;i++)
  if(c[i]>0) cout<<c[i];



return 0;
}

/**************************************************************
	Problem: 1177
	User: wtq001
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/