#28279: 測資2 TLE


math84081155@gmail.com (學系數)


不知道有沒有其他方法可以解 目前會的就是這些

 

 

#include<stdio.h>

#include<string.h>

char ch[100000001];

int main()

{

 

int num = 0;

 

fgets(ch,100000000,stdin);

 

int i = 0; 

    int b = strlen(ch) ;

while (b--)

{

if (ch[i] == ' '){

num++;

}

else{

if (num % 2 == 0){

printf("%c",ch[i]);

}

else{

 

printf(" %c",ch[i]);

 

}

num = 0;

}

i++;

return 0;

}