#include <bits/stdc++.h>
using
namespace
std;
int
main()
{
unordered_multimap<
char
,
char
> sample1, sample2;
sample1.insert({
'a'
,
'A'
});
sample1.insert({
'g'
,
'G'
});
sample2.insert({
'b'
,
'B'
});
sample2.insert({
'c'
,
'C'
});
sample2.insert({
'd'
,
'D'
});
cout <<
"Key and Elements of Sample1 before swap are:"
;
for
(
auto
it = sample1.begin(); it != sample1.end(); it++) {
cout <<
"{"
<< it->first <<
", "
<< it->second <<
"} "
;
}
cout <<
"\nKey and Elements of Sample2 before swap are:"
;
for
(
auto
it = sample2.begin(); it != sample2.end(); it++) {
cout <<
"{"
<< it->first <<
", "
<< it->second <<
"} "
;
}
sample1.swap(sample2);
cout <<
"\n\nKey and Elements of Sample1 after swap are:"
;
for
(
auto
it = sample1.begin(); it != sample1.end(); it++) {
cout <<
"{"
<< it->first <<
", "
<< it->second <<
"} "
;
}
cout <<
"\nKey and Elements of Sample2 after swap are:"
;
for
(
auto
it = sample2.begin(); it != sample2.end(); it++) {
cout <<
"{"
<< it->first <<
", "
<< it->second <<
"} "
;
}
return
0;
}