https://www.codechef.com/FXBG2020/problems/FTB003

Author : mishraayush1
Tester: mishraayush1
Editorialist : mishraayush1
Difficulty : easy
PREREQUISITES : String class
Solution : Find the frequency of the occurance of single character that is together and convert into string and store it , then set the counter variable to zero . Repeat the same procedure.
If input is AAABBA , then output will be 3A2B1A .

#include
#include
#include
using namespace std;
int main()
{
int c =0;
int t ;
cin>>t;
while(t–)
{
int i;
string s;
cin>>s;
string left ;
char letter = s[0];
c=0;
for(int i =0;i<s.length();i++)
{
if(s[i]== letter)
{
c=c+1;
}
else
{
ostringstream strg;
strg<<c;
left += strg.str()+letter;
letter = s[i];
c =1;
}

		}
	ostringstream strg;
	strg<<c;
	left +=   strg.str()+letter;
	cout<<left<<endl;
}

}