Codeforces 1093B. Letters Rearranging Solution
- Solution in c++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE,23rd batch
- ///Islamic University,Bangladesh
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int i,j,len,t;
- cin>>t;
- while(t--)
- {
- string a;
- cin>>a;
- len=a.length();
- sort(a.begin(),a.end());
- if(a[0]==a[len-1])
- cout<<"-1"<<endl;
- else
- cout<<a<<endl;
- }
- }
No comments