fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. string operation1(string s){
  5. return s;
  6. }
  7.  
  8. string operation2(string s){
  9. return s;
  10. }
  11.  
  12.  
  13. int main() {
  14. int t; cin >> t;
  15. while(t--){
  16. int n; cin >> n;
  17. string s; cin >> s; int len = s.length();
  18. string final;
  19. if(s[0]-'a' <= s[len-1]-'a')
  20. final = operation1(s);
  21. else
  22. final = operation2(s);
  23. cout << final << endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 5288KB
stdin
5
4
cpm
2
grib
10
kupitimilablodarbuz
1000000000
capybara
6
abacaba
stdout
cpm
grib
kupitimilablodarbuz
capybara
abacaba