1221-split-a-string-in-balanced-strings
DevGod needs to write a blog entry for this problem!
/**
* @param {string} s
* @return {number}
*/
var balancedStringSplit = function(s) {
let val = 0;
let A = 0;
for(a of s){
if(a == 'R'){
val++;
}else{
val+=-1;
}
if(val == 0){
A++;
}
}
return A;
};