//
// Created by xfj12 on 2025/3/27.
//
#include <solution/2712.h>
#include <string.h>
#define min(a, b) (a < b) ? (a) : (b)

long long minimumCost(char *s)
{
    int n = strlen(s);
    long long ans = 0;

    for (int i = 1; i < n; i++)
        if (s[i] != s[i - 1])
            ans += min(i, n - i);

    return ans;
}
