fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. char res[100001];
  10. int cnt[100001];
  11. class Solution{
  12. public:
  13. string removeDuplicates(string s, int k){
  14. int i;
  15. int sz = 0;
  16. int N = s.size();
  17. for(i=(0);i<(N);i++){
  18. if(sz==0 || res[sz-1] != s[i]){
  19. res[sz] = s[i];
  20. cnt[sz] = 1;
  21. sz++;
  22. }
  23. else{
  24. res[sz] = s[i];
  25. cnt[sz] = cnt[sz-1] + 1;
  26. sz++;
  27. if(cnt[sz-1] == k){
  28. sz -= k;
  29. }
  30. }
  31. }
  32. res[sz] = '\0';
  33. return (string)res;
  34. }
  35. }
  36. ;
  37. // cLay varsion 20191006-1
  38.  
  39. // --- original code ---
  40. // #define main dummy_main
  41. // {}
  42. // #undef main
  43. //
  44. // char res[100001];
  45. // int cnt[100001];
  46. //
  47. // class Solution {
  48. // public:
  49. // string removeDuplicates(string s, int k) {
  50. // int sz = 0, N = s.size();
  51. // rep(i,N){
  52. // if(sz==0 || res[sz-1] != s[i]){
  53. // res[sz] = s[i];
  54. // cnt[sz] = 1;
  55. // sz++;
  56. // } else {
  57. // res[sz] = s[i];
  58. // cnt[sz] = cnt[sz-1] + 1;
  59. // sz++;
  60. // if(cnt[sz-1] == k) sz -= k;
  61. // }
  62. // }
  63. // res[sz] = '\0';
  64. // return (string)res;
  65. // }
  66. // };
  67.  
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