-
What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
void PermutationString( string& orig, string& Permutation )
{
if (orig.empty())
{
cout << Permutation << endl;
return;
}
for (int k = 0; k < orig.size(); ++k)
{
string orig2 = orig;
orig2.erase(k, 1);
string Permutation2 = Permutation;
Permutation2 += orig.at(k);
PermutationString(orig2, Permutation2);
}
}
int main()
{
string orig = "Sumi";
string Permutation;
PermutationString(orig, Permutation);
return 0;
}
-
- Sumi
- imus
- suim
- returns all the combination of Sumi
- None of these
Correct Option: D
In the program, We used string permutation to find out all the combination.