Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check for cloning options
- string clone = "";
- int begin = 0;
- while (begin < final.size()) {
- string cloneable = "";
- // See if there's a character in the string already that can be cloned
- int found = final.find(target[final.size()], begin);
- if (found+1) {
- int i = 0;
- // Generates the longest cloneable string beginning at the found character
- while (target[found + i] == target[final.size() + i]) {
- cloneable.push_back(target[found]);
- i++;
- }
- // Prepare to look for another instance of the next character to append
- begin = found + i;
- if (clone.size() < cloneable.size()) { clone = cloneable;}
- }
- else {break;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement