Fetch the repository succeeded.
This action will force synchronization from 小墨/力扣题库(完整版), which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
<p>Table: <code>user_content</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| content_id | int |
| content_text| varchar |
+-------------+---------+
content_id is the unique key for this table.
Each row contains a unique ID and the corresponding text content.
</pre>
<p>Write a solution to transform the text in the <code>content_text</code> column by applying the following rules:</p>
<ul>
<li>Convert the <strong>first letter</strong> of each word to <strong>uppercase</strong> and the <strong>remaining</strong> letters to <strong>lowercase</strong></li>
<li>Special handling for words containing special characters:
<ul>
<li>For words connected with a hyphen <code>-</code>, <strong>both parts</strong> should be <strong>capitalized</strong> (<strong>e.g.</strong>, top-rated → Top-Rated)</li>
</ul>
</li>
<li>All other <strong>formatting</strong> and <strong>spacing</strong> should remain <strong>unchanged</strong></li>
</ul>
<p>Return <em>the result table that includes both the original <code>content_text</code> and the modified text following the above rules</em>.</p>
<p>The result format is in the following example.</p>
<p> </p>
<p><strong class="example">Example:</strong></p>
<div class="example-block">
<p><strong>Input:</strong></p>
<p>user_content table:</p>
<pre class="example-io">
+------------+---------------------------------+
| content_id | content_text |
+------------+---------------------------------+
| 1 | hello world of SQL |
| 2 | the QUICK-brown fox |
| 3 | modern-day DATA science |
| 4 | web-based FRONT-end development |
+------------+---------------------------------+
</pre>
<p><strong>Output:</strong></p>
<pre class="example-io">
+------------+---------------------------------+---------------------------------+
| content_id | original_text | converted_text |
+------------+---------------------------------+---------------------------------+
| 1 | hello world of SQL | Hello World Of Sql |
| 2 | the QUICK-brown fox | The Quick-Brown Fox |
| 3 | modern-day DATA science | Modern-Day Data Science |
| 4 | web-based FRONT-end development | Web-Based Front-End Development |
+------------+---------------------------------+---------------------------------+
</pre>
<p><strong>Explanation:</strong></p>
<ul>
<li>For content_id = 1:
<ul>
<li>Each word's first letter is capitalized: "Hello World Of Sql"</li>
</ul>
</li>
<li>For content_id = 2:
<ul>
<li>Contains the hyphenated word "QUICK-brown" which becomes "Quick-Brown"</li>
<li>Other words follow normal capitalization rules</li>
</ul>
</li>
<li>For content_id = 3:
<ul>
<li>Hyphenated word "modern-day" becomes "Modern-Day"</li>
<li>"DATA" is converted to "Data"</li>
</ul>
</li>
<li>For content_id = 4:
<ul>
<li>Contains two hyphenated words: "web-based" → "Web-Based"</li>
<li>And "FRONT-end" → "Front-End"</li>
</ul>
</li>
</ul>
</div>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。