HDU 2719 The Seven Percent Solution

#include <cstdio>
#include <cstring>
int main()
{
    char s[10000];
    while(gets(s),s[0]!='#')
    {
        int i=0;
        while (i<strlen(s)) 
        {
            if (s[i]==' ') printf("%s","%20");
            else if (s[i]=='!') printf("%s","%21");
            else if (s[i]=='$') printf("%s","%24");
            else if (s[i]=='%') printf("%s","%25");
            else if (s[i]=='(') printf("%s","%28");
            else if (s[i]==')') printf("%s","%29");
            else if (s[i]=='*') printf("%s","%2a");
            else printf("%c",s[i]);
            i++;
        }
        printf("\n");
    }
    return 0;    
}

 

posted @ 2013-12-20 16:36  forever97  阅读(141)  评论(0编辑  收藏  举报