#include <iostream> #include <string> #include <cstdlib> int main() { string s = "Brian W. Kernighan; The Practice of Programming; Addison Wesley"; string f; size_t start, after; start = s.find_first_not_of(" \t;"); after = s.find(";", start); cout << s.substr(start, after - start) << endl; return 0; } Output: Brian W. Kernighan