#include    <stdio.h>
#include    <string.h>

int han2zen(char *str)
{
char    *buf,*p,*ptr;

    buf=(char *)calloc(strlen(str)*2+1,sizeof(char));

    for(ptr=str,p=buf;*ptr!='\0';*ptr++){
        switch((int)*ptr){
            case    ' ': strcpy(p,"¡¡");p+=2;break;
            case    '!': strcpy(p,"¡ª");p+=2;break;
            case    '"': strcpy(p,"¡É");p+=2;break;
            case    '#': strcpy(p,"¡ô");p+=2;break;
            case    '$': strcpy(p,"¡ð");p+=2;break;
            case    '%': strcpy(p,"¡ó");p+=2;break;
            case    '&': strcpy(p,"¡õ");p+=2;break;
            case    '\'': strcpy(p,"¡Ç");p+=2;break;
            case    '(': strcpy(p,"¡Ê");p+=2;break;
            case    ')': strcpy(p,"¡Ë");p+=2;break;
            case    '*': strcpy(p,"¡ö");p+=2;break;
            case    '+': strcpy(p,"¡Ü");p+=2;break;
            case    ',': strcpy(p,"¡¤");p+=2;break;
            case    '-': strcpy(p,"¡Ý");p+=2;break;
            case    '.': strcpy(p,"¡¥");p+=2;break;
            case    '/': strcpy(p,"¡¿");p+=2;break;
            case    '0': strcpy(p,"£°");p+=2;break;
            case    '1': strcpy(p,"£±");p+=2;break;
            case    '2': strcpy(p,"£²");p+=2;break;
            case    '3': strcpy(p,"£³");p+=2;break;
            case    '4': strcpy(p,"£´");p+=2;break;
            case    '5': strcpy(p,"£µ");p+=2;break;
            case    '6': strcpy(p,"£¶");p+=2;break;
            case    '7': strcpy(p,"£·");p+=2;break;
            case    '8': strcpy(p,"£¸");p+=2;break;
            case    '9': strcpy(p,"£¹");p+=2;break;
            case    ':': strcpy(p,"¡§");p+=2;break;
            case    ';': strcpy(p,"¡¨");p+=2;break;
            case    '<': strcpy(p,"¡ã");p+=2;break;
            case    '=': strcpy(p,"¡á");p+=2;break;
            case    '>': strcpy(p,"¡ä");p+=2;break;
            case    '?': strcpy(p,"¡©");p+=2;break;
            case    '@': strcpy(p,"¡÷");p+=2;break;
            case    'A': strcpy(p,"£Á");p+=2;break;
            case    'B': strcpy(p,"£Â");p+=2;break;
            case    'C': strcpy(p,"£Ã");p+=2;break;
            case    'D': strcpy(p,"£Ä");p+=2;break;
            case    'E': strcpy(p,"£Å");p+=2;break;
            case    'F': strcpy(p,"£Æ");p+=2;break;
            case    'G': strcpy(p,"£Ç");p+=2;break;
            case    'H': strcpy(p,"£È");p+=2;break;
            case    'I': strcpy(p,"£É");p+=2;break;
            case    'J': strcpy(p,"£Ê");p+=2;break;
            case    'K': strcpy(p,"£Ë");p+=2;break;
            case    'L': strcpy(p,"£Ì");p+=2;break;
            case    'M': strcpy(p,"£Í");p+=2;break;
            case    'N': strcpy(p,"£Î");p+=2;break;
            case    'O': strcpy(p,"£Ï");p+=2;break;
            case    'P': strcpy(p,"£Ð");p+=2;break;
            case    'Q': strcpy(p,"£Ñ");p+=2;break;
            case    'R': strcpy(p,"£Ò");p+=2;break;
            case    'S': strcpy(p,"£Ó");p+=2;break;
            case    'T': strcpy(p,"£Ô");p+=2;break;
            case    'U': strcpy(p,"£Õ");p+=2;break;
            case    'V': strcpy(p,"£Ö");p+=2;break;
            case    'W': strcpy(p,"£×");p+=2;break;
            case    'X': strcpy(p,"£Ø");p+=2;break;
            case    'Y': strcpy(p,"£Ù");p+=2;break;
            case    'Z': strcpy(p,"£Ú");p+=2;break;
            case    '[': strcpy(p,"¡Î");p+=2;break;
            case    '\\': strcpy(p,"¡ï");p+=2;break;
            case    ']': strcpy(p,"¡Ï");p+=2;break;
            case    '^': strcpy(p,"¡°");p+=2;break;
            case    '_': strcpy(p,"¡²");p+=2;break;
            case    '`': strcpy(p,"¡Æ");p+=2;break;
            case    'a': strcpy(p,"£á");p+=2;break;
            case    'b': strcpy(p,"£â");p+=2;break;
            case    'c': strcpy(p,"£ã");p+=2;break;
            case    'd': strcpy(p,"£ä");p+=2;break;
            case    'e': strcpy(p,"£å");p+=2;break;
            case    'f': strcpy(p,"£æ");p+=2;break;
            case    'g': strcpy(p,"£ç");p+=2;break;
            case    'h': strcpy(p,"£è");p+=2;break;
            case    'i': strcpy(p,"£é");p+=2;break;
            case    'j': strcpy(p,"£ê");p+=2;break;
            case    'k': strcpy(p,"£ë");p+=2;break;
            case    'l': strcpy(p,"£ì");p+=2;break;
            case    'm': strcpy(p,"£í");p+=2;break;
            case    'n': strcpy(p,"£î");p+=2;break;
            case    'o': strcpy(p,"£ï");p+=2;break;
            case    'p': strcpy(p,"£ð");p+=2;break;
            case    'q': strcpy(p,"£ñ");p+=2;break;
            case    'r': strcpy(p,"£ò");p+=2;break;
            case    's': strcpy(p,"£ó");p+=2;break;
            case    't': strcpy(p,"£ô");p+=2;break;
            case    'u': strcpy(p,"£õ");p+=2;break;
            case    'v': strcpy(p,"£ö");p+=2;break;
            case    'w': strcpy(p,"£÷");p+=2;break;
            case    'x': strcpy(p,"£ø");p+=2;break;
            case    'y': strcpy(p,"£ù");p+=2;break;
            case    'z': strcpy(p,"£ú");p+=2;break;
            case    '{': strcpy(p,"¡Ð");p+=2;break;
            case    '|': strcpy(p,"¡Ã");p+=2;break;
            case    '}': strcpy(p,"¡Ñ");p+=2;break;
            default:
                *p=*ptr;
                p++;
                *p='\0';
                break;
        }
    }
    strcpy(str,buf);
    free(buf);

    return(0);
}

int zen2han(char *str)
{
char    *buf,*p,*ptr;

    buf=(char *)calloc(strlen(str)+1,sizeof(char));

    for(ptr=str,p=buf;*ptr!='\0';*ptr++){
        if(strncmp(ptr,"¡¡",2)==0){*p=' ';p++;ptr++;}
        else if(strncmp(ptr,"¡ª",2)==0){*p='!';p++;ptr++;}
        else if(strncmp(ptr,"¡É",2)==0){*p='"';p++;ptr++;}
        else if(strncmp(ptr,"¡ô",2)==0){*p='#';p++;ptr++;}
        else if(strncmp(ptr,"¡ð",2)==0){*p='$';p++;ptr++;}
        else if(strncmp(ptr,"¡ó",2)==0){*p='%';p++;ptr++;}
        else if(strncmp(ptr,"¡õ",2)==0){*p='&';p++;ptr++;}
        else if(strncmp(ptr,"¡Ç",2)==0){*p='\'';p++;ptr++;}
        else if(strncmp(ptr,"¡Ê",2)==0){*p='(';p++;ptr++;}
        else if(strncmp(ptr,"¡Ë",2)==0){*p=')';p++;ptr++;}
        else if(strncmp(ptr,"¡ö",2)==0){*p='*';p++;ptr++;}
        else if(strncmp(ptr,"¡Ü",2)==0){*p='+';p++;ptr++;}
        else if(strncmp(ptr,"¡¤",2)==0){*p=',';p++;ptr++;}
        else if(strncmp(ptr,"¡Ý",2)==0){*p='-';p++;ptr++;}
        else if(strncmp(ptr,"¡¥",2)==0){*p='.';p++;ptr++;}
        else if(strncmp(ptr,"¡¿",2)==0){*p='/';p++;ptr++;}
        else if(strncmp(ptr,"£°",2)==0){*p='0';p++;ptr++;}
        else if(strncmp(ptr,"£±",2)==0){*p='1';p++;ptr++;}
        else if(strncmp(ptr,"£²",2)==0){*p='2';p++;ptr++;}
        else if(strncmp(ptr,"£³",2)==0){*p='3';p++;ptr++;}
        else if(strncmp(ptr,"£´",2)==0){*p='4';p++;ptr++;}
        else if(strncmp(ptr,"£µ",2)==0){*p='5';p++;ptr++;}
        else if(strncmp(ptr,"£¶",2)==0){*p='6';p++;ptr++;}
        else if(strncmp(ptr,"£·",2)==0){*p='7';p++;ptr++;}
        else if(strncmp(ptr,"£¸",2)==0){*p='8';p++;ptr++;}
        else if(strncmp(ptr,"£¹",2)==0){*p='9';p++;ptr++;}
        else if(strncmp(ptr,"¡§",2)==0){*p=':';p++;ptr++;}
        else if(strncmp(ptr,"¡¨",2)==0){*p=';';p++;ptr++;}
        else if(strncmp(ptr,"¡ã",2)==0){*p='<';p++;ptr++;}
        else if(strncmp(ptr,"¡á",2)==0){*p='=';p++;ptr++;}
        else if(strncmp(ptr,"¡ä",2)==0){*p='>';p++;ptr++;}
        else if(strncmp(ptr,"¡©",2)==0){*p='?';p++;ptr++;}
        else if(strncmp(ptr,"¡÷",2)==0){*p='@';p++;ptr++;}
        else if(strncmp(ptr,"£Á",2)==0){*p='A';p++;ptr++;}
        else if(strncmp(ptr,"£Â",2)==0){*p='B';p++;ptr++;}
        else if(strncmp(ptr,"£Ã",2)==0){*p='C';p++;ptr++;}
        else if(strncmp(ptr,"£Ä",2)==0){*p='D';p++;ptr++;}
        else if(strncmp(ptr,"£Å",2)==0){*p='E';p++;ptr++;}
        else if(strncmp(ptr,"£Æ",2)==0){*p='F';p++;ptr++;}
        else if(strncmp(ptr,"£Ç",2)==0){*p='G';p++;ptr++;}
        else if(strncmp(ptr,"£È",2)==0){*p='H';p++;ptr++;}
        else if(strncmp(ptr,"£É",2)==0){*p='I';p++;ptr++;}
        else if(strncmp(ptr,"£Ê",2)==0){*p='J';p++;ptr++;}
        else if(strncmp(ptr,"£Ë",2)==0){*p='K';p++;ptr++;}
        else if(strncmp(ptr,"£Ì",2)==0){*p='L';p++;ptr++;}
        else if(strncmp(ptr,"£Í",2)==0){*p='M';p++;ptr++;}
        else if(strncmp(ptr,"£Î",2)==0){*p='N';p++;ptr++;}
        else if(strncmp(ptr,"£Ï",2)==0){*p='O';p++;ptr++;}
        else if(strncmp(ptr,"£Ð",2)==0){*p='P';p++;ptr++;}
        else if(strncmp(ptr,"£Ñ",2)==0){*p='Q';p++;ptr++;}
        else if(strncmp(ptr,"£Ò",2)==0){*p='R';p++;ptr++;}
        else if(strncmp(ptr,"£Ó",2)==0){*p='S';p++;ptr++;}
        else if(strncmp(ptr,"£Ô",2)==0){*p='T';p++;ptr++;}
        else if(strncmp(ptr,"£Õ",2)==0){*p='U';p++;ptr++;}
        else if(strncmp(ptr,"£Ö",2)==0){*p='V';p++;ptr++;}
        else if(strncmp(ptr,"£×",2)==0){*p='W';p++;ptr++;}
        else if(strncmp(ptr,"£Ø",2)==0){*p='X';p++;ptr++;}
        else if(strncmp(ptr,"£Ù",2)==0){*p='Y';p++;ptr++;}
        else if(strncmp(ptr,"£Ú",2)==0){*p='Z';p++;ptr++;}
        else if(strncmp(ptr,"¡Î",2)==0){*p='[';p++;ptr++;}
        else if(strncmp(ptr,"¡ï",2)==0){*p='\\';p++;ptr++;}
        else if(strncmp(ptr,"¡Ï",2)==0){*p=']';p++;ptr++;}
        else if(strncmp(ptr,"¡°",2)==0){*p='^';p++;ptr++;}
        else if(strncmp(ptr,"¡²",2)==0){*p='_';p++;ptr++;}
        else if(strncmp(ptr,"¡Æ",2)==0){*p='`';p++;ptr++;}
        else if(strncmp(ptr,"£á",2)==0){*p='a';p++;ptr++;}
        else if(strncmp(ptr,"£â",2)==0){*p='b';p++;ptr++;}
        else if(strncmp(ptr,"£ã",2)==0){*p='c';p++;ptr++;}
        else if(strncmp(ptr,"£ä",2)==0){*p='d';p++;ptr++;}
        else if(strncmp(ptr,"£å",2)==0){*p='e';p++;ptr++;}
        else if(strncmp(ptr,"£æ",2)==0){*p='f';p++;ptr++;}
        else if(strncmp(ptr,"£ç",2)==0){*p='g';p++;ptr++;}
        else if(strncmp(ptr,"£è",2)==0){*p='h';p++;ptr++;}
        else if(strncmp(ptr,"£é",2)==0){*p='i';p++;ptr++;}
        else if(strncmp(ptr,"£ê",2)==0){*p='j';p++;ptr++;}
        else if(strncmp(ptr,"£ë",2)==0){*p='k';p++;ptr++;}
        else if(strncmp(ptr,"£ì",2)==0){*p='l';p++;ptr++;}
        else if(strncmp(ptr,"£í",2)==0){*p='m';p++;ptr++;}
        else if(strncmp(ptr,"£î",2)==0){*p='n';p++;ptr++;}
        else if(strncmp(ptr,"£ï",2)==0){*p='o';p++;ptr++;}
        else if(strncmp(ptr,"£ð",2)==0){*p='p';p++;ptr++;}
        else if(strncmp(ptr,"£ñ",2)==0){*p='q';p++;ptr++;}
        else if(strncmp(ptr,"£ò",2)==0){*p='r';p++;ptr++;}
        else if(strncmp(ptr,"£ó",2)==0){*p='s';p++;ptr++;}
        else if(strncmp(ptr,"£ô",2)==0){*p='t';p++;ptr++;}
        else if(strncmp(ptr,"£õ",2)==0){*p='u';p++;ptr++;}
        else if(strncmp(ptr,"£ö",2)==0){*p='v';p++;ptr++;}
        else if(strncmp(ptr,"£÷",2)==0){*p='w';p++;ptr++;}
        else if(strncmp(ptr,"£ø",2)==0){*p='x';p++;ptr++;}
        else if(strncmp(ptr,"£ù",2)==0){*p='y';p++;ptr++;}
        else if(strncmp(ptr,"£ú",2)==0){*p='z';p++;ptr++;}
        else if(strncmp(ptr,"¡Ð",2)==0){*p='{';p++;ptr++;}
        else if(strncmp(ptr,"¡Ã",2)==0){*p='|';p++;ptr++;}
        else if(strncmp(ptr,"¡Ñ",2)==0){*p='}';p++;ptr++;}
        else{ *p=*ptr; p++; }
    }
    strcpy(str,buf);
    free(buf);

    return(0);
}
