Apple Pen Gym - 102680B

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.

1n10001≤n≤1000

1charactersPerItemName10001≤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

Input
2
I have a Apple
I have a Pen
I have a Apple-Pen
I have a Pen-Pineapple

Output
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;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YukiRinLL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值