Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Couting number of substring occurances in C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int countFreq(string str, string str_to_search) { int count = 0, nPos = str.find(str_to_search, 0); // fist occurrence while (nPos != string::npos) { count++; nPos = str.find(str_to_search, nPos + 1); } cout << count; } int main() { int chars; cin >> chars; string filename, finder; cin >> filename >> finder; countFreq(filename, finder); return 0; }
run
|
edit
|
history
|
help
0
Make BinTree
Problema Siruri
Sort array of 0's and 1's
Addition of two matrix **Part 2
k1
Stock buy/sell, maximum subarray problem
Operation on Set Container
დიოფანტეს განტოლება
CPP - Pointers - Ex.1
stl_sizeof.cc