ETH官方钱包

前往
大廳
主題

[OJ練習] 272

テリ君(桃夫模式) | 2022-11-18 09:26:28 | 巴幣 100 | 人氣 129

272

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

int main(void){
    char sen[100];
    int judge;
    
    while(gets(sen) != EOF){
        for(int i = 0; i < strlen(sen); i++){
            if(sen[i] == '"'){
                if(judge == 0){
                    printf("``");
                    judge = 1;
                }
                else{
                    printf("''");
                    judge = 0;
                }
            }
            else{
                printf("%c", sen[i]);
            }
        }
        printf("\n");
    }
    
    return 0;
}


2/5
原來要用gets 和 strlen

創作回應

更多創作