Given two strings as input. Your task is to find the longer string of the two strings, display the length of the longer string and concatenate the two strings and display the concatenated string.
Input:
First line of the input file contains an integer T which denotes the number of test cases. Then T test cases follow. First line of each test case contains a string A and second line contains another string B.
First line of the input file contains an integer T which denotes the number of test cases. Then T test cases follow. First line of each test case contains a string A and second line contains another string B.
Output:
Corresponding to each test case, In the first line print the length of the longer string and In the second line print the string obtained by concatenating the two strings.
Corresponding to each test case, In the first line print the length of the longer string and In the second line print the string obtained by concatenating the two strings.
.
Constraints:
1<=T<=10
1<=length(A)<=100
1<=length(B)<=100
Constraints:
1<=T<=10
1<=length(A)<=100
1<=length(B)<=100
Example:
Input:
1
Geeks
forGeeks
Input:
1
Geeks
forGeeks
Output:
8
8
Your Code
#include<iostream>
using namespace std;
#include<string.h>
int main()
{
int n;
cin>>n;
int x;
int i;
for(i=1; i<=n; i++)
{
char c1[100];
char c2[100];
cin>>c1>>c2;
if(strlen(c1)>strlen(c2))
{
x= strlen(c1);
cout<<x<<endl;
cout<<c1<<c2<<endl;
}
else
{ x=strlen(c2);
cout<<x<<endl;
cout<<c1<<c2<<endl; }
}
return 0;
}