If you consider yourself at all good at programming you should be able to answer this:
Write a function rem(c, s) that takes character c and a string s as inputs and removes the last and only the last occurrence of c.
Example:
>>rem('c','science')
'sciene'
Attached: csnoob.png (1600x490, 26K)
Do your own homework, fucker.
Read the string backwards and use a bool to determine if the character has been found already.
Then delete the character from the original string, and set the bool to true.
I'm not coding the problem for you.
string remc(char c, string s){
string a = s;
string b =" ";
while(a.find(c)!=string::npos)
{
b+= a.substr(0, a.find(c) + 1 );
a = a.substr(a.find(c) + 1, a.size() - a.find(c) - 1 );
}
b = b.substr(0, b.size() - 1) + a;
return b;
}
In a real language.
Reversing is for homos.
>Asks 4chin for homework help
Never gonna make it brah
Screw you guys, figured it out myself anyway
lmftfy
>string remc(char c, string s){
>>if(size_t n = s.find_last_of(c); n != string::npos){
>>>s.erase(n,1);
>>}
>>return s;
>}
>python
pathetic. try learning a REAL programming language like html
which programming language has the most aspie users?