代码拉取完成,页面将自动刷新
<p>You are given the strings <code>key</code> and <code>message</code>, which represent a cipher key and a secret message, respectively. The steps to decode <code>message</code> are as follows:</p>
<ol>
<li>Use the <strong>first</strong> appearance of all 26 lowercase English letters in <code>key</code> as the <strong>order</strong> of the substitution table.</li>
<li>Align the substitution table with the regular English alphabet.</li>
<li>Each letter in <code>message</code> is then <strong>substituted</strong> using the table.</li>
<li>Spaces <code>' '</code> are transformed to themselves.</li>
</ol>
<ul>
<li>For example, given <code>key = "<u><strong>hap</strong></u>p<u><strong>y</strong></u> <u><strong>bo</strong></u>y"</code> (actual key would have <strong>at least one</strong> instance of each letter in the alphabet), we have the partial substitution table of (<code>'h' -> 'a'</code>, <code>'a' -> 'b'</code>, <code>'p' -> 'c'</code>, <code>'y' -> 'd'</code>, <code>'b' -> 'e'</code>, <code>'o' -> 'f'</code>).</li>
</ul>
<p>Return <em>the decoded message</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2022/05/08/ex1new4.jpg" style="width: 752px; height: 150px;" />
<pre>
<strong>Input:</strong> key = "the quick brown fox jumps over the lazy dog", message = "vkbs bs t suepuv"
<strong>Output:</strong> "this is a secret"
<strong>Explanation:</strong> The diagram above shows the substitution table.
It is obtained by taking the first appearance of each letter in "<u><strong>the</strong></u> <u><strong>quick</strong></u> <u><strong>brown</strong></u> <u><strong>f</strong></u>o<u><strong>x</strong></u> <u><strong>j</strong></u>u<u><strong>mps</strong></u> o<u><strong>v</strong></u>er the <u><strong>lazy</strong></u> <u><strong>d</strong></u>o<u><strong>g</strong></u>".
</pre>
<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2022/05/08/ex2new.jpg" style="width: 754px; height: 150px;" />
<pre>
<strong>Input:</strong> key = "eljuxhpwnyrdgtqkviszcfmabo", message = "zwx hnfx lqantp mnoeius ycgk vcnjrdb"
<strong>Output:</strong> "the five boxing wizards jump quickly"
<strong>Explanation:</strong> The diagram above shows the substitution table.
It is obtained by taking the first appearance of each letter in "<u><strong>eljuxhpwnyrdgtqkviszcfmabo</strong></u>".
</pre>
<p> </p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>26 <= key.length <= 2000</code></li>
<li><code>key</code> consists of lowercase English letters and <code>' '</code>.</li>
<li><code>key</code> contains every letter in the English alphabet (<code>'a'</code> to <code>'z'</code>) <strong>at least once</strong>.</li>
<li><code>1 <= message.length <= 2000</code></li>
<li><code>message</code> consists of lowercase English letters and <code>' '</code>.</li>
</ul>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。