Skip to content

Instantly share code, notes, and snippets.

@emlai
Created June 4, 2017 14:32
Show Gist options
  • Save emlai/b93bfec90299397fbfd44abbae790a86 to your computer and use it in GitHub Desktop.
Save emlai/b93bfec90299397fbfd44abbae790a86 to your computer and use it in GitHub Desktop.
#include <string>
#include <iostream>
using namespace std;
int main() {
string s = "lollero";
string t = "lerolo";
auto si = s.begin() + 3;
auto ti = t.begin();
while (true) {
if (si == s.end()) {
si = s.begin();
}
if (ti == t.end()) {
cout << "match";
break;
}
if (*si != *ti) {
cout << "mismatch";
break;
}
si++;
ti++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment