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. class Solution{
  10. public:
  11. int countCharacters(vector<string>& words, string chars){
  12. int cnt[26], i, k, res=0;
  13. for(k=0;k<(words.size());k++){
  14. for(i=0;i<(26);i++){
  15. cnt[i] = 0;
  16. }
  17. for(i=0;i<(chars.size());i++){
  18. cnt[chars[i]-'a']++;
  19. }
  20. for(i=0;i<(words[k].size());i++){
  21. cnt[words[k][i]-'a']--;
  22. }
  23. for(i=0;i<(26);i++){
  24. if(cnt[i] < 0){
  25. break;
  26. }
  27. }
  28. if(i==26){
  29. res += words[k].size();
  30. }
  31. }
  32. return res;
  33. }
  34. }
  35. ;
  36. // cLay varsion 20190820-1
  37.  
  38. // --- original code ---
  39. // #define main dummy_main
  40. // {}
  41. // #undef main
  42. //
  43. // class Solution {
  44. // public:
  45. // int countCharacters(vector<string>& words, string chars) {
  46. // int i, cnt[26], res = 0;
  47. //
  48. // rep(k,words.size()){
  49. // rep(i,26) cnt[i] = 0;
  50. // rep(i,chars.size()) cnt[chars[i]-'a']++;
  51. // rep(i,words[k].size()) cnt[words[k][i]-'a']--;
  52. // rep(i,26) if(cnt[i] < 0) break;
  53. // if(i==26) res += words[k].size();
  54. // }
  55. //
  56. // return res;
  57. // }
  58. // };
  59.  
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