Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool start_with(string start, string s)
- {
- if (start.find(s) == 0)
- {
- return true;
- }
- return false;
- }
- int main()
- {
- string input;
- cout << "Enter a String with (\" and \"): ";
- cin >> input;
- string startT = "(\"";
- string endT = "\")";
- int startLen = startT.length(); // 2
- int endLen = endT.length(); // 2
- int strLen = input.length(); // if hello => 2+5+2 = 9
- cout << strLen << endl;
- string output = ""; // output = 9 - 2 - 2 => strLen - endLen - startLen
- output = input.substr(startLen, (strLen - endLen - startLen));
- cout << output << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment