Problem description Given two strings A and B, this problem requires you to output A+B, which is the union of the two strings.
It is required to output A first and then B, but repeated characters must be eliminated.
Input format
input respectively given in two rows A and B, both the length of not more than 10 . 6 is, seen from the ASCII characters and spaces, identified by the end of the transport of non-empty string.
Output format
Output the sum of A and B required by the title in one line.
输入样例
This is a sample test
to show you_How it works
Output sample
This ampletowyu_Hrk
answer:
#include <iostream>
using namespace std;
string s, a, b;
bool used[150];
int main()
{
getline(cin, a);
getline(cin, b);
s = a + b;
for (int i = 0; i < s.size(); i ++)
if(!used[s[i]])
{
cout << s[i];
used[s[i]] = true;
}
return 0;
}