fork download
  1. #include <iostream>
  2. #include <string>
  3. //#include <conio.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. //clrscr();
  9. string m;
  10. cout << "Sentence: ";
  11. cin >> m;
  12. cout << "String length = " << m.size() << "\n";
  13. string::size_type i = m.find_first_of("bB");
  14. if (i != string::npos) {
  15. m.insert(i, "cb");
  16. }
  17. cout << "New Sentence : " << m << "\n";
  18. cout << "count of letters = " << m.size();
  19. cin.get();
  20. }
Success #stdin #stdout 0.01s 5464KB
stdin
dasdasB
stdout
Sentence: String length = 7
New Sentence : dasdascbB
count of letters = 9