String reverse output
Description
If a line of characters is specified, this line is output in reverse order (space. Number is not output)
-
Input
-
The first line is an integer n (n <10) indicating the number of test data groups). Each group of test data occupies one row, there is only one space in the middle of each line of data (you can read this line as two strings ). Each line can contain up to 40 characters in length and must contain only one space, numbers, and lowercase letters.
-
Output
-
Corresponding to each row of test data, output in reverse order (no space or number output)
-
Sample Input
-
3abc 123deabc 123abc d
-
Sample output
-
edcbacbadcba
#include <iostream>#include <string.h>using namespace std; int main(){int n;cin>>n;char a[41];char b[41];int m1,m2;while(n--){ cin>>a; cin>>b; m1 = strlen(a); m2 = strlen(b); for(int j=m2-1;j>=0;j--){ if(b[j]>=‘A‘ && b[j] <=‘z‘) cout<<b[j]; } for(int i=m1-1;i>=0;i--){ if(a[i]>=‘A‘ && a[i] <=‘z‘) cout<<a[i]; } cout<<endl;}return 0; }
String reverse output