fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. std::string s("[SectionName]");
  7. size_t first = s.find_first_of('[');
  8. size_t last = s.find_last_of(']');
  9. if (string::npos != first && string::npos != last)
  10. {
  11. std::cout << s.substr(first + 1, last - first - 1);
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
SectionName