My issue
in this code output is coming right but when i try to submit it ,it gives wrong answer.
My code
// Update the code below to solve this problem
#include <stdio.h>
#include <string.h>
int main() {
int t;
scanf("%d", &t); // read the number of test cases
for (int i = 0; i < t; i++) { // iterate through each test case
char S[1001], A[1001], B[1001];
scanf("%s", S); // read the input string
int len = strlen(S); // find the length of the string
// copy the string S into the string A
for (int j = 0; j < len; j++) {
A[j]=S[j];
}
for (int j = 0; j < len; j++) {
B[j]=S[j];
}
for(int i=0,j=len-1;i<j;i++,j--){
char temp=B[i];
B[i]=B[j];
B[j]=temp;
}
printf("%s\n%s\n",A,B);
}
return 0;
}
Learning course: Beginner DSA in C
Problem Link: CodeChef: Practical coding for everyone