Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int pos(const string& a, const string& b) {
- int n = a.size();
- int m = b.size();
- if (m < n) return -1;
- for (int i = 0; i < (m - n); ++i) {
- bool salta = false;
- int j = 0;
- while (j < n and not salta) {
- if (a[j] != '?' and a[j] != b[i + j]) salta = true;
- ++j;
- }
- if (not salta) return i;
- }
- return -1;
- }
- int main(){
- int n;
- string x = "A?TC";
- string y = "AGGGTCATCAATCGTC";
- while (cin >> n) {
- cout << pos(x, y) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement