fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. template<class S, class T> inline S chmax(S &a, T b){
  5. if(a<b){
  6. a=b;
  7. }
  8. return a;
  9. }
  10. vector<string> Explode_L(const string &str, const string &d){
  11. int s = 0;
  12. int i = 0;
  13. int j;
  14. vector<string> res;
  15. while(i + d.size() - 1 < str.size()){
  16. for(j=(0);j<(d.size());j++){
  17. if(str[i+j] != d[j]){
  18. break;
  19. }
  20. }
  21. if(j != d.size()){
  22. i++;
  23. continue;
  24. }
  25. res.push_back(str.substr(s, i-s));
  26. s = (i += d.size());
  27. }
  28. res.push_back(str.substr(s));
  29. return res;
  30. }
  31. #define main dummy_main
  32. int main(){
  33. return 0;
  34. }
  35. #undef main
  36. class Solution{
  37. public:
  38. vector<string> printVertically(string s){
  39. int Q5VJL1cS, RZTsC2BF, i;
  40. int x;
  41. int y;
  42. string tmp;
  43. vector<string> res;
  44. vector<string> in;
  45. in =Explode_L(s, " ");
  46. x = in.size();
  47. y = 0;
  48. for(i=(0);i<(x);i++){
  49. chmax(y, in[i].size());
  50. }
  51. for(Q5VJL1cS=(0);Q5VJL1cS<(x);Q5VJL1cS++){
  52. tmp += " ";
  53. }
  54. for(RZTsC2BF=(0);RZTsC2BF<(y);RZTsC2BF++){
  55. res.push_back(tmp);
  56. }
  57. for(i=(0);i<(x);i++){
  58. int j;
  59. for(j=(0);j<(in[i].size());j++){
  60. res[j][i] = in[i][j];
  61. }
  62. }
  63. for(i=(0);i<(y);i++){
  64. while(res[i][res[i].size()-1]==' '){
  65. res[i] = res[i].substr(0, res[i].size() - 1);
  66. }
  67. }
  68. return res;
  69. }
  70. }
  71. ;
  72. // cLay varsion 20200119-1
  73.  
  74. // --- original code ---
  75. // #define main dummy_main
  76. // {}
  77. // #undef main
  78. //
  79. // class Solution {
  80. // public:
  81. // vector<string> printVertically(string s) {
  82. // int x, y;
  83. // string tmp;
  84. // vector<string> res, in;
  85. // in = Explode(s, " ");
  86. // x = in.size();
  87. // y = 0;
  88. // rep(i,x) y >?= in[i].size();
  89. //
  90. // rep(x) tmp += " ";
  91. // rep(y) res.push_back(tmp);
  92. //
  93. // rep(i,x) rep(j,in[i].size()) res[j][i] = in[i][j];
  94. // rep(i,y) while(res[i][res[i].size()-1]==' ') res[i] = res[i].substr(0, res[i].size() - 1);
  95. //
  96. // return res;
  97. // }
  98. // };
  99.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty