1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -9,10 +9,10 @@
"titleSlug": "goat-latin",
"content": "<p>You are given a string <code>sentence</code> that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only.</p>\n\n<p>We would like to convert the sentence to &quot;Goat Latin&quot; (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows:</p>\n\n<ul>\n\t<li>If a word begins with a vowel (<code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, or <code>&#39;u&#39;</code>), append <code>&quot;ma&quot;</code> to the end of the word.\n\n\t<ul>\n\t\t<li>For example, the word <code>&quot;apple&quot;</code> becomes <code>&quot;applema&quot;</code>.</li>\n\t</ul>\n\t</li>\n\t<li>If a word begins with a consonant (i.e., not a vowel), remove the first letter and append it to the end, then add <code>&quot;ma&quot;</code>.\n\t<ul>\n\t\t<li>For example, the word <code>&quot;goat&quot;</code> becomes <code>&quot;oatgma&quot;</code>.</li>\n\t</ul>\n\t</li>\n\t<li>Add one letter <code>&#39;a&#39;</code> to the end of each word per its word index in the sentence, starting with <code>1</code>.\n\t<ul>\n\t\t<li>For example, the first word gets <code>&quot;a&quot;</code> added to the end, the second word gets <code>&quot;aa&quot;</code> added to the end, and so on.</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>Return<em> the final sentence representing the conversion from sentence to Goat Latin</em>.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n<pre><strong>Input:</strong> sentence = \"I speak Goat Latin\"\n<strong>Output:</strong> \"Imaa peaksmaaa oatGmaaaa atinLmaaaaa\"\n</pre><p><strong>Example 2:</strong></p>\n<pre><strong>Input:</strong> sentence = \"The quick brown fox jumped over the lazy dog\"\n<strong>Output:</strong> \"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n</pre>\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= sentence.length &lt;= 150</code></li>\n\t<li><code>sentence</code> consists of English letters and spaces.</li>\n\t<li><code>sentence</code> has no leading or trailing spaces.</li>\n\t<li>All the words in <code>sentence</code> are separated by a single space.</li>\n</ul>\n",
"translatedTitle": "山羊拉丁文",
"translatedContent": "<p>给一个由空格分割单词的句子&nbsp;<code>S</code>。每个单词只包含大写小写字母。</p>\n\n<p>我们要将句子转换为&nbsp;<em>&ldquo;Goat Latin&rdquo;</em>(一种类似于 猪拉丁文&nbsp;- Pig Latin 的虚构语言)。</p>\n\n<p>山羊拉丁文的规则如下:</p>\n\n<ul>\n\t<li>如果单词以元音开头(a, e, i, o, u在单词后添加<code>&quot;ma&quot;</code>。<br />\n\t例如,单词<code>&quot;apple&quot;</code>变为<code>&quot;applema&quot;</code>。</li>\n\t<br />\n\t<li>如果单词以辅音字母开头(即非元音字母),移除第一个字符并将它放到末尾,之后再添加<code>&quot;ma&quot;</code>。<br />\n\t例如,单词<code>&quot;goat&quot;</code>变为<code>&quot;oatgma&quot;</code>。</li>\n\t<br />\n\t<li>根据单词在句子中的索引,在单词最后添加与索引相同数量的字母<code>&#39;a&#39;</code>索引从1开始。<br />\n\t例如,在第一个单词后添加<code>&quot;a&quot;</code>,在第二个单词后添加<code>&quot;aa&quot;</code>,以此类推。</li>\n</ul>\n\n<p>返回将&nbsp;<code>S</code>&nbsp;转换为山羊拉丁文后的句子。</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>&quot;I speak Goat Latin&quot;\n<strong>输出: </strong>&quot;Imaa peaksmaaa oatGmaaaa atinLmaaaaa&quot;\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>&quot;The quick brown fox jumped over the lazy dog&quot;\n<strong>输出: </strong>&quot;heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa&quot;\n</pre>\n\n<p><strong>说明:</strong></p>\n\n<ul>\n\t<li><code>S</code>&nbsp;中仅包含大小写字母和空格。单词间有且仅有一个空格。</li>\n\t<li><code>1 &lt;= S.length &lt;= 150</code>。</li>\n</ul>\n",
"translatedContent": "<p>给一个由若干单词组成的句子&nbsp;<code>sentence</code> ,单词间由空格分隔。每个单词仅由大写小写英文字母组成。</p>\n\n<p>请你将句子转换为 <em>“</em>山羊拉丁文(<em>Goat Latin</em><em>”</em>(一种类似于 猪拉丁文&nbsp;- Pig Latin 的虚构语言)。山羊拉丁文的规则如下:</p>\n\n<ul>\n\t<li>如果单词以元音开头(<code>'a'</code>, <code>'e'</code>, <code>'i'</code>, <code>'o'</code>, <code>'u'</code>),在单词后添加<code>\"ma\"</code>。\n\n\t<ul>\n\t\t<li>例如,单词 <code>\"apple\"</code> 变为 <code>\"applema\"</code> 。</li>\n\t</ul>\n\t</li>\n\t<li>如果单词以辅音字母开头(即非元音字母),移除第一个字符并将它放到末尾,之后再添加<code>\"ma\"</code>。\n\t<ul>\n\t\t<li>例如,单词 <code>\"goat\"</code> 变为 <code>\"oatgma\"</code> 。</li>\n\t</ul>\n\t</li>\n\t<li>根据单词在句子中的索引,在单词最后添加与索引相同数量的字母<code>'a'</code>,索引从 <code>1</code> 开始。\n\t<ul>\n\t\t<li>例如,在第一个单词后添加 <code>\"a\"</code> ,在第二个单词后添加 <code>\"aa\"</code> ,以此类推。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>返回将 <code>sentence</code> 转换为山羊拉丁文后的句子。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入</strong>sentence = \"I speak Goat Latin\"\n<strong>输出</strong>\"Imaa peaksmaaa oatGmaaaa atinLmaaaaa\"\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入</strong>sentence = \"The quick brown fox jumped over the lazy dog\"\n<strong>输出</strong>\"heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa\"\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= sentence.length &lt;= 150</code></li>\n\t<li><code>sentence</code> 由英文字母和空格组成</li>\n\t<li><code>sentence</code> 不含前导或尾随空格</li>\n\t<li><code>sentence</code> 中的所有单词由单个空格分隔</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 59,
"likes": 121,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -137,7 +137,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"19.1K\", \"totalSubmission\": \"30.8K\", \"totalAcceptedRaw\": 19088, \"totalSubmissionRaw\": 30836, \"acRate\": \"61.9%\"}",
"stats": "{\"totalAccepted\": \"49.8K\", \"totalSubmission\": \"76.2K\", \"totalAcceptedRaw\": 49827, \"totalSubmissionRaw\": 76216, \"acRate\": \"65.4%\"}",
"hints": [],
"solution": null,
"status": null,