Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

when I run this source code I have see errors so plz removethe errors if it poss

ID: 3616025 • Letter: W

Question

when I run this source code I have see errors so plz removethe errors if it possible...... I want the output will be like this:                                                   OUTPUT enter a string:computer              science new string is : computer science enter any letter: p letter p = 4 source code #include <iostream>
using namespace std;
int main()
{int i,j=0;
string s;
char newstring[100];
char last='1';     //set to anything butblank
cout<<"enter a string: ";
getline(cin,s);
for(i=0;s[i]!='';i++)
    {
     if(s[i]==' ')
        {if(last!=' ')
          newstring[j++]=s[i];
                 
        }
     elseif(s[i]=='('&&s[i+2]==')')
         {newstring[j++]=s[i+1];
          i+=2;
          }    
     else
         newstring[j++]=s[i];
    
    
     last=s[i];
     }
newstring[j]=''; cout<<" original string:"<<s<<endl;
cout<<"enter any letter: "<<letter<<endl;
system("pause");
return 0;
}
when I run this source code I have see errors so plz removethe errors if it possible...... I want the output will be like this:                                                   OUTPUT enter a string:computer              science new string is : computer science enter any letter: p letter p = 4 source code #include <iostream>
using namespace std;
int main()
{int i,j=0;
string s;
char newstring[100];
char last='1';     //set to anything butblank
cout<<"enter a string: ";
getline(cin,s);
for(i=0;s[i]!='';i++)
    {
     if(s[i]==' ')
        {if(last!=' ')
          newstring[j++]=s[i];
                 
        }
     elseif(s[i]=='('&&s[i+2]==')')
         {newstring[j++]=s[i+1];
          i+=2;
          }    
     else
         newstring[j++]=s[i];
    
    
     last=s[i];
     }
newstring[j]=''; cout<<" original string:"<<s<<endl;
cout<<"enter any letter: "<<letter<<endl;
system("pause");
return 0;
}

Explanation / Answer

please rate - thanks #include using namespace std; int main() {int i,j=0; string s; char newstring[100],letter; char last='1';     //set to anything butblank cout