#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    string word;
    cout << "Podaj ciag znakow: ";
    cin >> word;
    cout << "Wszystkie mozliwe kombinacje ciagu " << word << " to:\n" << word << "\n";
    while(next_permutation(word.begin(),word.end()))
        cout << word << "\n";
    return 0;
}
