Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <iterator>
- using namespace std;
- void PrintSpacesPositions(string& str) {
- for (string::size_type pos = 0; (pos = str.find(' ', pos)) != string::npos; ++pos) {
- cout << pos << endl;
- }
- }
- int main() {
- string str = "He said: one and one and one is three"s;
- PrintSpacesPositions(str);
- return 0;
- }
Add Comment
Please, Sign In to add comment