https://vjudge.net/problem/Gym-102680B/origin
https://vjudge.net/contest/396206#problem/B
After visiting the Apple store and playing with the new iPad Pro, many are hopelessly attracted to having their own Apple Pencil. However, because Apple Pencils have been brutally trademarked and are obscenely expensive, such visitors must settle for a compromise: making an Apple-Pen! Apple-Pens can be created by uh-ing a Pen with an Apple (uh-ing an Apple with a Pen would create a Pen-Apple, which, of course, is not nearly as cool). It has recently been discovered that this uh function can be applied to things other than apples and pens! Uhing item A with item B will create a new item: B-A. Given 2*n items, what will result when each pair of items are uhed?
Input
The first line will contain a single integer n, the number of times to perform the uh operation.
2*n lines follow. Each line will contain a sentence of the form "I have a <item>" where <item> is replaced by a single word of upper case letters, lower case letters, and hyphens (-), but not spaces.
1≤n≤10001≤n≤1000
1≤charactersPerItemName≤10001≤charactersPerItemName≤1000
Output
Output n lines each of the form "Uh! <item b>-<item a>!" where "<item b>" and "<item a>" are replaced by their respective items.
Example
2
I have a Apple
I have a Pen
I have a Apple-Pen
I have a Pen-Pineapple
Uh! Pen-Apple!
Uh! Pen-Pineapple-Apple-Pen!
Note
There are two test cases. In the first, an Apple is uhed with a Pen to create an Pen-Apple.
Sponsor
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define debug(x) cout<<"debug:"<<#x<<" = "<<x<<endl;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
//const int maxn=1e5+10;
const int maxn = 5010;
//const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7;
ch c1[1000] = {0};
ch c2[1000] = {0};
ch c0[1000] = {0};
int main()
{
int t = 0;
cin >> t;
while(t--)
{
cin >> c0 >> c0 >> c0 >> c1;
cin >> c0 >> c0 >> c0 >> c2;
cout << "Uh! ";
for(int j = 0;c2[j]!='\0';j++)
{
cout << c2[j];
}
cout << "-";
for(int i = 0;c1[i]!='\0';i++)
{
cout << c1[i];
}
cout << "!" << endl;
}
return 0;
}