fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <map>
  4. #include <numeric>
  5. #include <set>
  6. #include <sstream>
  7. #include <string>
  8. #include <vector>
  9. using namespace std;
  10.  
  11. class LongWordsDiv2 {
  12.  
  13. public: string find(string word) {
  14. bool flag=false;
  15. for(int i=0;i<word.size()-1;i++){
  16. if(word[i]==word[i+1])flag=true;
  17. }
  18.  
  19. for(int i=0;i<word.size()-1;i++){
  20. for(int j=i+1;j<word.size();j++){
  21. char one = word[i],two = word[j];
  22. int cnt=0;
  23. for(int k=j+1;k<word.size()-1;k++){
  24. for(int l=k+1;l<word.size();l++){
  25. if(word[k]==one && word[l]==two)cnt++;
  26. }
  27. }
  28. if(cnt>=1)flag=true;
  29. }
  30. }
  31. if(flag)return "Dislikes";
  32. else return "Likes";
  33. }
  34.  
  35. };
  36.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘std::string LongWordsDiv2::find(std::string)’:
prog.cpp:15:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<word.size()-1;i++){
                             ^
prog.cpp:19:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<word.size()-1;i++){
                             ^
prog.cpp:20:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=i+1;j<word.size();j++){
                              ^
prog.cpp:23:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k=j+1;k<word.size()-1;k++){
                                ^
prog.cpp:24:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int l=k+1;l<word.size();l++){
                               ^
/usr/lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty