fork download
  1. #include <bits/stdc++.h>
  2. #include<string.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int t;cin>>t;
  7. while(t-->0)
  8. {
  9. char str[1000],st1[1000],st2[1000];
  10. cin>>str;
  11. int l=strlen(str),i;
  12. if(l%2==0)
  13. {
  14. int k=0;
  15. for(i=0;i<l/2;i++)
  16. st1[i]=str[i];
  17. for(i=l/2;i<l;i++)
  18. {
  19. st2[k++]=str[i];
  20. }
  21. }
  22. else
  23. {
  24. int k=0,h=l/2;
  25. for(i=0;i<h;i++)
  26. st1[i]=str[i];
  27. for(i=h+1;i<l;i++)
  28. {
  29. st2[k++]=str[i];
  30. }
  31. }
  32. cout<<st1<<endl<<st2;
  33. sort(st1.begin(),st1.end());
  34. sort(st2.begin(),st2.end());
  35. cout<<st1<<endl<<st2;
  36. /*if(st1==st2)
  37.   cout<<"YES"<<endl;
  38.   else
  39.   cout<<"NO"<<endl;*/
  40. }
  41. return 0;
  42. }
  43.  
  44.  
Compilation error #stdin compilation error #stdout 0s 4512KB
stdin
1
gaga
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:33:18: error: request for member ‘begin’ in ‘st1’, which is of non-class type ‘char [1000]’
         sort(st1.begin(),st1.end());
                  ^~~~~
prog.cpp:33:30: error: request for member ‘end’ in ‘st1’, which is of non-class type ‘char [1000]’
         sort(st1.begin(),st1.end());
                              ^~~
prog.cpp:34:18: error: request for member ‘begin’ in ‘st2’, which is of non-class type ‘char [1000]’
         sort(st2.begin(),st2.end());
                  ^~~~~
prog.cpp:34:30: error: request for member ‘end’ in ‘st2’, which is of non-class type ‘char [1000]’
         sort(st2.begin(),st2.end());
                              ^~~
stdout
Standard output is empty