Given two strings A and B, this question requires you to output A + B, i.e., the union of two strings. Required to output A, then the output B, but is repeated characters must be rejected.
Input formats:
Input respectively given in two rows A and B, are no longer than 1, seen from the ASCII character (i.e. code values 32 to 126) and spaces, the end of the non-identified by a carriage return empty string.
Output formats:
Requested output issues surface in a line of A and B and.
Sample input:
This is a sample test
to show you_How it works
Sample output:
This ampletowyu_Hrk
String search method to
#include <iostream> using namespace std; int main() { string a,b,ans=""; getline(cin,a); getline(cin,b); for(int i=0;i<a.length();i++) if(ans.find(a[i])==ans.npos)ans+=a[i]; for(int i=0;i<b.length();i++) if(ans.find(b[i])==ans.npos)ans+=b[i]; cout<<ans; system("pause"); return 0; }