fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. string s= "2+2*3+3";
  7. int n = s.length();
  8. int i=0;
  9. for(i;i<n;i++)
  10. {
  11. if(s[i]== '*')
  12. {
  13.  
  14. s.erase(i-1,2);
  15. s[i-1]= 'a';
  16. break;
  17. }
  18.  
  19.  
  20. }
  21. cout << s<< " " << i;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
2+a+3 3