JavaScript program to find minimum replacements such that the difference between the index of the same characters is divisible by 3 Function to count the number of minimal replacements
function countMinimalReplacements ( s ) { var n = s . length ;