/CODE - Chuyển Mã

<Problem>

http://ntucoder.net/Problem/Details/3315
              Uses Crt;
        Var st,st1:string; temp1,i:longint; kt:boolean;
        Begin
            readln(st);
            temp1:=ord(st[1]);
            if (st[1]='_') or (st[length(st)]='_') then
            begin
                write('Error!');
                exit;
            end;
            if (pos('__',st)>0) then
            begin
                write('Error!');
                exit;
            end;
            if (temp1>=97) and (temp1<=122) then
            begin
                if (pos('_',st)<>0) then
                begin
                    kt:=true;
                    for i:=1 to length(st) do
                    begin
                        if st[i]<>'_' then
                        begin
                            temp1:=ord(st[i]);
                            if (temp1<97) or (temp1>122) then
                            begin
                                kt:=false;
                                //writeln('Error!');
                                break;
                            end;
                        end;
                    end;
                    if kt=false then begin writeln('Error!'); exit; end;
                    if kt=true then
                    begin
                        while (pos('_',st)<>0) do
                        begin
                            i:=pos('_',st);
                            st[i+1]:=chr(ord(st[i+1])-32);
                            delete(st,pos('_',st),1);
                        end;
                        writeln(st); exit;
                    end;
                end
                else
                if (pos('_',st)=0) then
                begin
                    st1:='';
                    for i:=1 to length(st) do
                    begin
                        if (st[i]>='A') and (st[i]<='Z') then
                        begin
                            st1:=st1+'_';
                            st[i]:=chr(ord(st[i])+32);
                            st1:=st1+st[i];
                        end
                        else
                        st1:=st1+st[i];
                    end;
                    writeln(st1); exit;
                end;
            end;
            write('Error!');
            readln;
        End.