#include<bits/stdc++.h>
using namespace std;
bool is_digit(char c){
return c >= '0' && c <= '9';
}
bool is_alpha(char c){
if(c >= 'a' && c <= 'z'){
return true;
}
if(c >= 'A' && c <= 'Z'){
return true;
}
return false;
}
string func1(string s){
string res = "";
res += s[0];
for(int i = 0; i < s.size() - 1; i++){
if((is_digit(s[i]) && is_alpha(s[i + 1])) || (is_alpha(s[i]) && is_digit(s[i + 1]))){
res += '_';
}
res += s[i + 1];
}
return res;
}
string func2(string s){
string res = "";
bool visit[128] = {false};
for(int i = 0; i < s.size(); i++){
if(is_digit(s[i]) && !visit[s[i]]){
visit[s[i]] = true;
res += s[i];
}
if((s[i] >= 'a' && s[i] <= 'z') && !visit[s[i] - 32]){
visit[s[i] - 32] = true;
res += s[i];
}
if((s[i] >= 'A' && s[i] <= 'Z') && !visit[s[i]]){
visit[s[i]] = true;
res += s[i];
}
}
return res;
}
int main(){
string str;
while(cin >> str){
string str1 = func1(str);
string str2 = func2(str);
cout << str1 << endl << str2 << endl;
}
return 0;
}
把ASCII表中a与A之间距离记成20了,其实是十六进制的20

京公网安备 11010502036488号