Clarification with vectors

I m writing the parts of code I dont understand

vector encodedChar;

int count

while( ){
encodedChar.push_back(to_string(count)[0]);
encodedChar.push_back(previousChar);
}

Im not able to understand how the line after the while is working because it is pushing back at the same position every iteration

which question you are trying??

from where this code you have taken??
if from video content mention it with time stamp

the thing I seek to understand is the line:

push_back(to_string(count)[0]);

what is the use of [0] in this line.

the question is run length encoding

when you convert count into string
after that you are taking only first character of the string
so you write
to_string(count)[0];

using namespace std;

string runLengthEncoding(string str) {
vector encodedStringChar;
int counter = 1;

for(int i = 1; i<str.size(); i++){
char currentChar = str[i];
char previousChar = str[i - 1];

	if(currentChar != previousChar || counter == 9){
		encodedStringChar.push_back(to_string(counter)[0]);
		encodedStringChar.push_back(previousChar);
		counter = 0;
	}
	counter ++;
	}
	
	encodedStringChar.push_back(to_string(counter)[0]);
	encodedStringChar.push_back(str[str.size() - 1]);
	
	string encodedString(encodedStringChar.begin(),
											encodedStringChar.end());
											
	return encodedString;

}

this is the complete solution why does it get only accepted when keep the [0] after the to_string(count) even though the converted sting only has 1 character

can you send the link of question

why counter can not be greater than 9
any character can come more than 9

for example if a’s are 13 then we write it as 9A4A and not like 13A the same goes with any other character. you wont be able to access question from where I saw it because it is a paid service
but here is a more simpler version of it here if there are 13 a’s then it will be written as 13A.
https://www.techiedelight.com/run-length-encoding-rle-data-compression-algorithm/

if so then it’s okay
your counter is single digit no so you need only one character after converting into string
if counter is 4 then
to_string(count) ==> “4\0”
now you have to take only first character
all strings contains “\0” at end