Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  code
Language: C/C++
Code:
     #include <stdio.h>
#include <string.h>

int main() {

    int n,i,j,x,y;
    int k,l;
    char even[5000],odd[5000];
    char str[10][10000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
       scanf("%s",&str[i]);
    }
    for(i=0;i<n;i++){
        k=0;
        l=0;
        for(j=0;j<strlen(str[i]);j++){

       
            if(j%2==0){
                even[k++]=str[i][j];
            }else{
                odd[l++]=str[i][j];
                
            }
        
   } 
     for(x=0;x<k;x++){
         printf("%c",even[x]);
     }    
     printf(" ");
     for(y=0;y<l;y++){
         printf("%c",odd[y]);
     }
     printf("\n");
          }
          
    return 0;
}
Comments: