For this Question: Given a string S and an integer K, your task is to find the lexicographically maximum string after performing at most K swaps.The first line of input contains a single string S. The next line of input contains the value of K.

Constraints:-
1 <= |S| <= 9
S contains digits from 1 to 9
1 <= K <= 4Print the lexicographically maximum string after performing at most K swaps.Sample Input:-
132
2

Sample Output:-
321

Sample Input:-
254
1

Sample Output:-
524, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
void doit(string &A, int moves, string &ans) {
    if(moves == 0) {
        ans = max(ans, A);
        return;
    }
    int n = A.length();
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            swap(A[i], A[j]);
            doit(A, moves-1, ans);
            swap(A[i], A[j]);
        }
    }
}

string solve(string A, int B) {
    string ans = A;
    doit(A, B, ans);
    return ans;
}

int main(){
    string s;
    cin>>s;
    int n;
    cin>>n;
    cout<<solve(s,n);
    
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?