(hdu 1048)The Hardest Problem Ever

1101 단어 문자열 조작c
제목 주소:http://acm.hdu.edu.cn/showproblem.php?pid=1048
문자열 물 문제, 관건 은 세심 해 야 한다.WA 가 여러 번...
#include 
#include 
char mess[300], start[20], end[20];

int main(void)
{
        int i;
        while (scanf("%s%*c", start) != EOF) {
                if (strcmp(start, "ENDOFINPUT") == 0)
                        break;
                if (strcmp(start, "START") == 0) {
                        gets(mess);
                        for (i = 0; i < strlen(mess); i++) {
                                if (mess[i] >= 'A' && mess[i] <= 'Z') {
                                        mess[i] -= 5;
                                        if (mess[i] < 'A')
                                        mess[i] += 26;
                                }
                        }
                        scanf("%s%*c", end);
                        if (strcmp(end, "END") == 0)
                                puts(mess);
                }
        }
        return 0;
}

좋은 웹페이지 즐겨찾기