Skip to content
Snippets Groups Projects
Select Git revision
  • e9006e133131da91a9853e2ddc550ac96b545cd9
  • main default protected
  • history
3 results

Header.tsx

Blame
  • Forked from ajou-pay / client-user
    Source project has a limited visibility.
    6443.cpp 601 B
    #include<iostream>
    #include<vector>
    #include<string>
    #include<algorithm>
    using namespace std;
    
    void back(int idx, string str, int len)
    {
        if(idx == len - 1)
        {
            cout << str << "\n";
            return;
        }
    
        for(int i=idx;i<len;i++)
        {
            if(i != idx && str[i] == str[idx])
                continue;
            if(str[i] != str[idx])
                swap(str[i], str[idx]);
    
            back(idx+1, str, len);
        }
    
    }
    
    int main()
    {
        int t;
        cin >> t;
        while(t--)
        {
            string in;
            cin >> in;
    
            sort(in.begin(), in.end());
    
            back(0, in, in.size());
        }
    }