SC:Pls help for this programing problem in c++ (standard IO without file read/write),better with some comment about why coding that way,thanks
Problem C: String Connection
Time limit: 2 second
Problem Description
Write a program to connect strings. Given two strings s1 and s2 the connection of s1 and s2 is the shortest string that has s1 as the prefix (beginning of a string, and s2 as the suffix (the ending of a string). For example if we connect "birthday" and "daylight" we will get "birthdaylight". For another example, if we connect "birthdays" and "daylight", we will get "birthdaysdaylight". Now given N strings, S, ... S, which consist of lowercase letters, please output the result of connecting s1 and s2, then connecting to s3, and so on.
Input
The first line contains a positive integer N indicating the number of test cases. Each case contains a positive integer M, where 2 < M <=30.The next M lines contain the strings S to Sm.The length of all strings is between 1 and 100
Output
You should output the length and the string of connecting s1, and s2, then s3, and so on.
Sample Input:
Sample Output:
2 3 abc bcdef 32 news paper
abcdefg
newspaper