I'm pretty new to C++ and am working on a simple function to convert letters to integers (L to 1, O to 0, B to 8) but keep getting a result that's just a "1". The cout is still just "1" in the function body so I'm wondering if I'm misunderstanding str.replace();? Is there a way to change multiple characters without it being super bulky?Here's my source code below. Thanks in advance
#include<iostream>
#include<string>
using namespace std;
string encodeString(string str){
    
    
    for(int i=0;i<str.size();i++){
            toupper(str[i]);
            
            str.replace(str.begin(),str.end(),"O",'0');
            str.replace(str.begin(),str.end(),"L",'1');
            str.replace(str.begin(),str.end(),"B",'8');
            //converts index to uppercase and replaces with integer value if L, O, B
        
    } 
    cout<<str;
    return str;
}
int main() {
    
    string str;
    cout<<"Enter your string: "<<endl;
    getline(cin,str);
    cout<<"Your encoded string : "<<encodeString(str);
    
}
