Calculate the score of the combined string i . e . the count of occurrences of " ab " as subsequences
let final_score = 0 , count_a = 0 ; for ( let i = 0 ; i < combined_string . length ; i ++ ) { if ( combined_string [ i ] == ' ' ) {