<p>You are given a string s of length <code>n</code> containing only four kinds of characters: <code>'Q'</code>, <code>'W'</code>, <code>'E'</code>, and <code>'R'</code>.</p>
<p>A string is said to be <strong>balanced</strong><em></em>if each of its characters appears <code>n / 4</code> times where <code>n</code> is the length of the string.</p>
<p>Return <em>the minimum length of the substring that can be replaced with <strong>any</strong> other string of the same length to make </em><code>s</code><em><strong>balanced</strong></em>. If s is already <strong>balanced</strong>, return <code>0</code>.</p>