Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void bm(string &tablica, string &wzorzec) {
- int index = 0;
- int s;
- bool indexChanged;
- while (index < tablica.size()) {
- indexChanged = false;
- for (int i = wzorzec.size()-1; i >= 0; i--) {
- if ((index + i) >= tablica.size())
- return;
- if (tablica[index + i] != wzorzec[i]) {
- for (s = 0; s < wzorzec.size(); s++) {
- if (wzorzec[s] == tablica[index + i]) {
- index += wzorzec.size() - s - 1;
- indexChanged = true;
- break;
- }
- }
- if (!indexChanged) {
- index += wzorzec.size();
- indexChanged = true;
- }
- }
- }
- if (!indexChanged) {
- cout << "TUTEJ JEST: " << index << endl;
- index++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement