Skip to content

Commit ba2cf3e

Browse files
Create Even Splits.cpp
Added the solution of codechef question
1 parent 2c159af commit ba2cf3e

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

cpp/Even Splits.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int tatab;
6+
cin>>tatab;
7+
while(tatab--){
8+
9+
int w;
10+
cin>>w;
11+
string s;
12+
cin>>s;
13+
14+
int n = s.length();
15+
16+
17+
char a[n + 1];
18+
19+
20+
strcpy(a, s.c_str());
21+
22+
sort(a,a+n);
23+
if(s.length()<3){
24+
cout<<s<<endl;
25+
}
26+
else {
27+
for(int i=0;i<n;i++){
28+
cout<<a[i];
29+
}
30+
cout<<endl;
31+
}
32+
}
33+
return 0;
34+
}

0 commit comments

Comments
 (0)