Answer:
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
cout << "Enter a word: ";
cin >> a;
cout << "Enter a word: ";
cin >> b;
string temp = a;
a = b;
b = temp;
cout << "a: " << a << endl;
cout << "b: " << b << endl;
return 0;
}
Step-by-step explanation:
Sample Output:
Enter a word: apple
Enter a word: zebra
a: zebra
b: apple