All pastes #507929 Raw Edit

satan

public cpp v1 · immutable
·published 2007-05-24 20:13 UTC
rendered paste body
void perm(int k, string p, string s){	/*if (k ==0)	{		cout << s << endl;		return;	}*/	if (p.length() + s.length() == k)	{		//cout << p << s << endl;		return;	}	string temp = s;	//string array[s.length()];	for (int i = 0; i < s.length(); i++)	{			char prefix = s.at(i);		temp.erase(i,1);		cout << temp << endl;		perm(k,p + prefix, temp);		temp.insert(i,&prefix);				temp = s;	}	return;}