#include<iostream>#include<algorithm>#include<stdio.h>#include<string.h>using namespace std;char line[2000], buff[500];struct chrs{ char chr[100];} achrs[100];int num, s, e, intp, chrp;int ints[500];bool ioc[1000];bool operator<( const chrs& a, const chrs& b ){ char ta, tb; for( int i=0; ; i++ ) { ta=a.chr[i]; tb=b.chr[i]; if( ta>='a') ta-=32; if( tb>='a' ) tb-=32; if( ta<tb ) return 1; else if( ta>tb ) return 0; }}int main(){ while( cin.getline (line , 255 , 'n') ) { if(line[0]=='.') break; num = s= intp = chrp = 0; for( num=0; ; num++ ) { for( e=s; line[e]!=',' && line[e]!='.' ; e++ ) buff[e-s]=line[e]; buff[e-s]=0; if( line[e]==',' ) s=e+2; if( buff[0]=='-' || ( buff[0]>='0' && buff[0]<='9' ) ) { ints[intp++]=atoi( buff ); ioc[num]=1; } else { strcpy( achrs[chrp++].chr, buff ); ioc[num]=0; } if( line[e]=='.' ) break; } sort(ints, ints+intp); sort( achrs, achrs+chrp); intp=chrp=0; for( int i=0; i<num; i++ ) { if( ioc[i] ) cout << ints[intp++]; else cout << achrs[chrp++].chr; cout << ", "; } if( ioc[num] ) cout << ints[intp++]; else cout << achrs[chrp++].chr; cout << "." << endl; } return 0;}