Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. // Check for cloning options
  2. string clone = "";
  3. int begin = 0;
  4.  
  5. while (begin < final.size()) {
  6. string cloneable = "";
  7.  
  8. // See if there's a character in the string already that can be cloned
  9. int found = final.find(target[final.size()], begin);
  10. if (found+1) {
  11. int i = 0;
  12.  
  13. // Generates the longest cloneable string beginning at the found character
  14. while (target[found + i] == target[final.size() + i]) {
  15. cloneable.push_back(target[found]);
  16. i++;
  17. }
  18.  
  19. // Prepare to look for another instance of the next character to append
  20. begin = found + i;
  21. if (clone.size() < cloneable.size()) { clone = cloneable;}
  22. }
  23. else {break;}
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement