Below is almost correct program, there is only one line code is wrong, you have to fix it.
input String str contains only a and b characters, below code checks whether str contains qual number of a and b characters
void checkBalance(string str)
for( i=j=0; temp[i] = str[j]; j++)
if(strpj[ == temp[i])