<p>给你一个方程,左边用 <code>words</code> 表示,右边用 <code>result</code> 表示。</p> <p>你需要根据以下规则检查方程是否可解:</p> <ul> <li>每个字符都会被解码成一位数字(0 - 9)。</li> <li>每对不同的字符必须映射到不同的数字。</li> <li>每个 <code>words[i]</code> 和 <code>result</code> 都会被解码成一个没有前导零的数字。</li> <li>左侧数字之和(<code>words</code>)等于右侧数字(<code>result</code>)。 </li> </ul> <p>如果方程可解,返回 <code>True</code>,否则返回 <code>False</code>。</p> <p> </p> <p><strong>示例 1:</strong></p> <pre><strong>输入:</strong>words = ["SEND","MORE"], result = "MONEY" <strong>输出:</strong>true <strong>解释:</strong>映射 'S'-> 9, 'E'->5, 'N'->6, 'D'->7, 'M'->1, 'O'->0, 'R'->8, 'Y'->'2' 所以 "SEND" + "MORE" = "MONEY" , 9567 + 1085 = 10652</pre> <p><strong>示例 2:</strong></p> <pre><strong>输入:</strong>words = ["SIX","SEVEN","SEVEN"], result = "TWENTY" <strong>输出:</strong>true <strong>解释:</strong>映射 'S'-> 6, 'I'->5, 'X'->0, 'E'->8, 'V'->7, 'N'->2, 'T'->1, 'W'->'3', 'Y'->4 所以 "SIX" + "SEVEN" + "SEVEN" = "TWENTY" , 650 + 68782 + 68782 = 138214</pre> <p><strong>示例 3:</strong></p> <pre><strong>输入:</strong>words = ["THIS","IS","TOO"], result = "FUNNY" <strong>输出:</strong>true </pre> <p><strong>示例 4:</strong></p> <pre><strong>输入:</strong>words = ["LEET","CODE"], result = "POINT" <strong>输出:</strong>false </pre> <p> </p> <p><strong>提示:</strong></p> <ul> <li><code>2 <= words.length <= 5</code></li> <li><code>1 <= words[i].length, results.length <= 7</code></li> <li><code>words[i], result</code> 只含有大写英文字母</li> <li>表达式中使用的不同字符数最大为 10</li> </ul>