Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<vector>
- #include<map>
- #include<cstdio>
- #include<iomanip>
- using namespace std;
- vector<string>words;
- map<int,int>wordPos;
- int wordCnt=0;
- void splitIntoWords(string s)
- {
- int len = s.size();
- string temp="";
- int k=0,i;
- for(i=0;i<len;i++)
- {
- if(s[i]==' ')
- {
- words.push_back(temp);
- wordPos[k++]=i;
- temp="";
- }
- temp+=s[i];
- }
- words.push_back(temp);
- wordPos[k++]=i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement