Skip to content

Instantly share code, notes, and snippets.

@own2pwn
Created October 20, 2016 18:07
Show Gist options
  • Save own2pwn/12bc7cfcc831155219a63dda53035fa0 to your computer and use it in GitHub Desktop.
Save own2pwn/12bc7cfcc831155219a63dda53035fa0 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
int main() {
string s1,s2;
cin >> s1 >> s2;
int count = 0;
auto currPos = s2.find(s1, 0);
while(currPos != string::npos)
{
count++;
currPos = s2.find(s1, currPos + 1);
}
cout << count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment