#include <iostream>
#include <cstring>
using namespace std;
const int START=0;//start state
const int CONTINUE=1;//common prefix identifier state
const int JAVAWORD=2;//intermediate states
const int CPPWORD=3;
const int CPPDEL=4;//CPP-delimeter
const int JAVA=5;//final states
const int CPP=6;
const int UNIVERSAL=7;
const int JAVAERR=8;
const int CPPERR=9;
const int ERROR=10;
char var[101];
char result[203]={'\0'};
int reslen=0;
int state;
bool is_small(char c)
{
return ('a'<= c && c <= 'z');
}
bool is_big(char c)
{
return ('A'<= c && c <= 'Z');
}
bool is_underscore(char c)
{
return (c == '_');
}
int selection_of_style(char * var, size_t len)
{
char c=var[0];
state = START;
if(is_small(c))
{
state = CONTINUE;
}
if(is_big(c))
{
state = ERROR;
return state;
}
if(is_underscore(c))
{
state = ERROR;
return state;
}
for (int i=1; i<len; i++)
{
c=var[i];
if(is_small(c)) state = state;
if(is_big(c))
{
state = JAVAWORD;
return state;
}
if(is_underscore(c))
{
state = CPPWORD;
return state;
}
}
//if(state==CONTINUE)
state = UNIVERSAL;
return state;
}
int is_java(char * var, size_t len)
{
for (int i=0; i<len; i++)
{
char c=var[i];
if(is_small(c))
{
state = state;
}
if(is_big(c))
{
state = state;
}
if(is_underscore(c))
{
state = JAVAERR;
return state;
}
}
if(state==JAVAWORD)
{
state = JAVA;
}
return state;
}
int is_cpp(char * var, size_t len)
{
for (int i=0; i<len; i++)
{
char c=var[i];
if(is_small(c))
{
if(state==CPPDEL)
{
state=CPPWORD;
}
else
state = state;
}
if(is_big(c))
{
state = JAVAERR;
return state;
}
if(is_underscore(c))
{
if(state==CPPDEL)
{
state=CPPERR;
return state;
}
state=CPPDEL;
}
}
if(state==CPPWORD)
{
state = CPP;
}
if(state==CPPDEL)
{
state=CPPERR;
}
return state;
}
void java_to_cpp(char * var, size_t len)
{
for(int i=0; i<len; i++)
{
char c=var[i];
if(is_small(c))
{
result[reslen++]=var[i];
}
if(is_big(c))
{
result[reslen++]='_';
result[reslen++]=var[i]+32;
}
}
}
void cpp_to_java(char * var, size_t len)
{
for(int i=0; i<len; i++)
{
char c=var[i];
if(is_small(c))
{
result[reslen++]=var[i];
}
if(is_underscore(c))
{
result[reslen++]=var[++i]-32;
}
}
}
int main()
{
cin >> var;
size_t len = strlen(var);
state=selection_of_style(var, len);
if(state==ERROR)
{
cout << "Error!" << endl;
return 0;
}
if(state==JAVAWORD)
state = is_java(var,len);
if(state==CPPWORD)
state = is_cpp(var,len);
if (state ==UNIVERSAL)
{
cout <<var<<endl;
return 0;
}
if(state==JAVAERR)
{
cout << "Error!" << endl;
return 0;
}
if(state==CPPERR)
{
cout << "Error!" << endl;
return 0;
}
if(state==JAVA)
{
java_to_cpp(var,len);
cout<<result;
return 0;
}
if(state==CPP)
{
cpp_to_java(var,len);
cout<<result;
return 0;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IFNUQVJUPTA7Ly9zdGFydCBzdGF0ZQpjb25zdCBpbnQgQ09OVElOVUU9MTsvL2NvbW1vbiBwcmVmaXggaWRlbnRpZmllciBzdGF0ZQpjb25zdCBpbnQgSkFWQVdPUkQ9MjsvL2ludGVybWVkaWF0ZSBzdGF0ZXMKY29uc3QgaW50IENQUFdPUkQ9MzsKY29uc3QgaW50IENQUERFTD00Oy8vQ1BQLWRlbGltZXRlcgpjb25zdCBpbnQgSkFWQT01Oy8vZmluYWwgc3RhdGVzCmNvbnN0IGludCBDUFA9NjsKY29uc3QgaW50IFVOSVZFUlNBTD03Owpjb25zdCBpbnQgSkFWQUVSUj04Owpjb25zdCBpbnQgQ1BQRVJSPTk7CmNvbnN0IGludCBFUlJPUj0xMDsKY2hhciB2YXJbMTAxXTsKY2hhciByZXN1bHRbMjAzXT17J1wwJ307CmludCByZXNsZW49MDsKaW50IHN0YXRlOwpib29sIGlzX3NtYWxsKGNoYXIgYykKewogIHJldHVybiAoJ2EnPD0gYyAmJiBjIDw9ICd6Jyk7Cn0KYm9vbCBpc19iaWcoY2hhciBjKQp7CiAgcmV0dXJuICgnQSc8PSBjICYmIGMgPD0gJ1onKTsKfQpib29sIGlzX3VuZGVyc2NvcmUoY2hhciBjKQp7CiAgcmV0dXJuIChjID09ICdfJyk7Cn0KaW50IHNlbGVjdGlvbl9vZl9zdHlsZShjaGFyICogdmFyLCBzaXplX3QgbGVuKQp7CiAgY2hhciBjPXZhclswXTsKICBzdGF0ZSA9IFNUQVJUOwogIGlmKGlzX3NtYWxsKGMpKQogICAgewogICAgICBzdGF0ZSA9IENPTlRJTlVFOwogICAgfQogIGlmKGlzX2JpZyhjKSkKICAgIHsKICAgICAgc3RhdGUgPSBFUlJPUjsKICAgICAgcmV0dXJuIHN0YXRlOwogICAgfQogIGlmKGlzX3VuZGVyc2NvcmUoYykpCiAgICB7CiAgICAgIHN0YXRlID0gRVJST1I7CiAgICAgIHJldHVybiBzdGF0ZTsKICAgIH0KICBmb3IgKGludCBpPTE7IGk8bGVuOyBpKyspCiAgICB7CiAgICAgIGM9dmFyW2ldOwogICAgICBpZihpc19zbWFsbChjKSkgc3RhdGUgPSBzdGF0ZTsKICAgICAgaWYoaXNfYmlnKGMpKQogICAgICAgIHsKICAgICAgICAgIHN0YXRlID0gSkFWQVdPUkQ7CiAgICAgICAgICByZXR1cm4gc3RhdGU7CiAgICAgICAgfQogICAgICBpZihpc191bmRlcnNjb3JlKGMpKQogICAgICAgIHsKICAgICAgICAgIHN0YXRlID0gQ1BQV09SRDsKICAgICAgICAgIHJldHVybiBzdGF0ZTsKICAgICAgICB9CiAgICB9CiAgLy9pZihzdGF0ZT09Q09OVElOVUUpCiAgc3RhdGUgPSBVTklWRVJTQUw7CiAgcmV0dXJuIHN0YXRlOwp9CmludCBpc19qYXZhKGNoYXIgKiB2YXIsIHNpemVfdCBsZW4pCnsKICBmb3IgKGludCBpPTA7IGk8bGVuOyBpKyspCiAgICB7CiAgICAgIGNoYXIgYz12YXJbaV07CiAgICAgIGlmKGlzX3NtYWxsKGMpKQogICAgICAgIHsKICAgICAgICAgIHN0YXRlID0gc3RhdGU7CiAgICAgICAgfQogICAgICBpZihpc19iaWcoYykpCiAgICAgICAgewogICAgICAgICAgc3RhdGUgPSBzdGF0ZTsKICAgICAgICB9CiAgICAgIGlmKGlzX3VuZGVyc2NvcmUoYykpCiAgICAgICAgewogICAgICAgICAgc3RhdGUgPSBKQVZBRVJSOwogICAgICAgICAgcmV0dXJuIHN0YXRlOwogICAgICAgIH0KICAgIH0KICBpZihzdGF0ZT09SkFWQVdPUkQpCiAgICB7CiAgICAgIHN0YXRlID0gSkFWQTsKICAgIH0KICByZXR1cm4gc3RhdGU7Cn0KaW50IGlzX2NwcChjaGFyICogdmFyLCBzaXplX3QgbGVuKQp7CiAgZm9yIChpbnQgaT0wOyBpPGxlbjsgaSsrKQogICAgewogICAgICBjaGFyIGM9dmFyW2ldOwogICAgICBpZihpc19zbWFsbChjKSkKICAgICAgICB7CiAgICAgICAgICBpZihzdGF0ZT09Q1BQREVMKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgc3RhdGU9Q1BQV09SRDsKICAgICAgICAgICAgfQogICAgICAgICAgZWxzZQogICAgICAgICAgICBzdGF0ZSA9IHN0YXRlOwogICAgICAgIH0KICAgICAgaWYoaXNfYmlnKGMpKQogICAgICAgIHsKICAgICAgICAgIHN0YXRlID0gSkFWQUVSUjsKICAgICAgICAgIHJldHVybiBzdGF0ZTsKICAgICAgICB9CgogICAgICBpZihpc191bmRlcnNjb3JlKGMpKQogICAgICAgIHsKICAgICAgICAgIGlmKHN0YXRlPT1DUFBERUwpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICBzdGF0ZT1DUFBFUlI7CiAgICAgICAgICAgICAgcmV0dXJuIHN0YXRlOwogICAgICAgICAgICB9CiAgICAgICAgICBzdGF0ZT1DUFBERUw7CiAgICAgICAgfQogICAgfQogIGlmKHN0YXRlPT1DUFBXT1JEKQogICAgewogICAgICBzdGF0ZSA9IENQUDsKICAgIH0KICBpZihzdGF0ZT09Q1BQREVMKQogICAgewogICAgICBzdGF0ZT1DUFBFUlI7CiAgICB9CiAgcmV0dXJuIHN0YXRlOwp9CnZvaWQgamF2YV90b19jcHAoY2hhciAqIHZhciwgc2l6ZV90IGxlbikKewogIGZvcihpbnQgaT0wOyBpPGxlbjsgaSsrKQogICAgewogICAgICBjaGFyIGM9dmFyW2ldOwogICAgICBpZihpc19zbWFsbChjKSkKICAgICAgICB7CiAgICAgICAgICByZXN1bHRbcmVzbGVuKytdPXZhcltpXTsKICAgICAgICB9CiAgICAgIGlmKGlzX2JpZyhjKSkKICAgICAgICB7CiAgICAgICAgICByZXN1bHRbcmVzbGVuKytdPSdfJzsKICAgICAgICAgIHJlc3VsdFtyZXNsZW4rK109dmFyW2ldKzMyOwogICAgICAgIH0KICAgIH0KfQp2b2lkIGNwcF90b19qYXZhKGNoYXIgKiB2YXIsIHNpemVfdCBsZW4pCnsKICBmb3IoaW50IGk9MDsgaTxsZW47IGkrKykKICAgIHsKICAgICAgY2hhciBjPXZhcltpXTsKICAgICAgaWYoaXNfc21hbGwoYykpCiAgICAgICAgewogICAgICAgICAgcmVzdWx0W3Jlc2xlbisrXT12YXJbaV07CiAgICAgICAgfQogICAgICBpZihpc191bmRlcnNjb3JlKGMpKQogICAgICAgIHsKICAgICAgICAgIHJlc3VsdFtyZXNsZW4rK109dmFyWysraV0tMzI7CiAgICAgICAgfQogICAgfQp9CmludCBtYWluKCkKewogIGNpbiA+PiB2YXI7CiAgc2l6ZV90IGxlbiA9IHN0cmxlbih2YXIpOwogIHN0YXRlPXNlbGVjdGlvbl9vZl9zdHlsZSh2YXIsIGxlbik7CiAgaWYoc3RhdGU9PUVSUk9SKQogICAgewogICAgICBjb3V0IDw8ICJFcnJvciEiIDw8IGVuZGw7CiAgICAgIHJldHVybiAwOwogICAgfQogIGlmKHN0YXRlPT1KQVZBV09SRCkKICAgIHN0YXRlID0gaXNfamF2YSh2YXIsbGVuKTsKICBpZihzdG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