Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. string temp = "";
  2. int lenTemp = 0;
  3.  
  4. int posS = 0;
  5. int key = 0;
  6. bool flagForIndex = true;
  7. false;
  8. bool flag = true;
  9. while (posS < s.length())
  10. {
  11. flag = true;
  12. int index = -1;
  13. flagForIndex = true;
  14. string tempStrInPrecBufMax = "";
  15. cout << tempStrInPrecBufMax;
  16. int len = -1;
  17. string secondTemp = "";
  18. while ((temp.find(tempStrInPrecBufMax) != std::string::npos || secondTemp.find(tempStrInPrecBufMax) != std::string::npos) && (posS < prevBufMax)) {
  19. tempStrInPrecBufMax += s[posS];
  20. posS++;
  21. len++;
  22. if (temp.length() > histBufMax)
  23. {
  24. string t = "";
  25. for (int i = temp.length() - histBufMax; i < temp.length(); i++)
  26. t += temp[i];
  27. temp = t;
  28. }
  29. if (temp.find(tempStrInPrecBufMax) != std::string::npos)
  30. {
  31. flagForIndex = false;
  32. index = temp.find(tempStrInPrecBufMax);
  33. }
  34. if (temp.find(tempStrInPrecBufMax) >= temp.length() - tempStrInPrecBufMax.length() && temp.find(tempStrInPrecBufMax) != std::string::npos) {
  35. if (flag){
  36. secondTemp = temp;
  37. flag = false;
  38. }
  39. secondTemp += s[key];
  40. key++;
  41. }
  42. else if (secondTemp.find(tempStrInPrecBufMax) != std::string::npos)
  43. {
  44. secondTemp += s[key];
  45. key++;
  46. }
  47. }
  48. if (index == -1)
  49. index = 0;
  50. else
  51. index = temp.length() - index;
  52. Node node(index, len, s[posS - 1]);
  53. res.push_back(node);
  54. key = posS;
  55. temp += tempStrInPrecBufMax;
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement