#include<stdio.h> int main() { int t; scanf("%d",&t); char str[t][200]; for(int i=0;i<=t;i++) { gets(str[i]); } for(int i=0;i<=t;i++) { for(int j=0;j<(strlen(str[i])/2);j=j+2) {printf("%c",str[i][j]); } printf("\n"); } return 0; } how to do it in single loop so as to reduce time complexity?
Reading, processing and outputting the answer for a single test case at a time would make the code easier to read and write, but wouldn’t reduce the amount of work done.
This line looks like it could be the problem.