http://www.spoj.com/problems/JAVAC/
import java.io.*;
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String s;int l;
PrintWriter ob=new PrintWriter(System.out);
while((s=in.readLine())!=null && (l=s.length())!=0)
{
s=s+" ";
String s3="";
int i,k=0; char ch,ch1;
for(i=0;i<l;i++)
{
ch=s.charAt(i);
ch1=s.charAt(i+1);
if(ch=='_' && (ch1>=65 && ch1<=90))
{
k=1;
break;
}
else if(ch=='_' && (ch1>=90 && ch1<=127))
k=2;
else if(ch>=65 && ch<=90)
s3=s3+"_"+Character.toLowerCase(ch);
else if(ch>=90 && ch<=127)
s3=s3+ch;
}
if(k==1)
ob.println("Error!");
else if(k==2)
{
String x[]=s.split("_");
String s2="";
int j=x.length;
s2=s2+x[0];
for(i=1;i<j;i++)
{
int p=x[i].length();
s2=s2+Character.toUpperCase(x[i].charAt(0));
s2=s2+x[i].substring(1,p);
}
ob.println(s2);
}
else
ob.println(s3);
}
ob.flush();
}
}