The if (end == pos) doesn't make sense to me. That would only be true if the first character is something that you are looking for and it isn't in that example. The way that is setup you have to check again for pos != string::npos after the find calls. You are on the right track with the looping but you need to use the debugger and step to solve the problem. Hopefully you are using a debugger that shows you the contents of the vector conveniently.
I am using the command line to compile as this is what it shows in my simple c++ book i have. I haven't been doing C++ for long so really appreciate any help.
With the command line I presum there is no debugging. I got really annoyed with M$ visual studio 2008 cos i couldn't create a simple file, I had to make a project. I might have to go back to that.
I don't know where you mean where i have to check again for pos != string::npos after the find calls
I have tried different things but the program keeps crashing
The project thing isn't really that hard to deal with, you can just "Create Empty Project" and you won't have to worry about anything. And VC++'s debugger is awesome IMO.
If you want to stick to the command line, you could try gdb (if you are using gcc or g++ it should be available).
The debugger is critical in this case. This is the kind of problem that debuggers were made for. If I had the time I'd step through it myself but then you wouldn't learn anything. VS2008 has a really nice debugger so try to use that first and if you have more questions then post some followup questions.