C. Pig Latin

Codeforces
IDCF10206C
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
https://en.wikipedia.org/wiki/Pig_Latin Pig Latin is a secret language which is similar to English. To convert an English word to Pig Latin, take the first letter of that word, move it to the end, and then add "ay". Peccy and Danbo are two Amazon mascots. They like sending each other messages over Amazon Chime, but they've realised that their messages are unencrypted! Help Peccy and Danbo encrypt their messages by converting them into Pig Latin. Make sure to check the examples. The first line will contain an integer T, where T is the number of sentences given. Each sentence will be on a new line and will not contain punctuation. However, they will be capitalised at the beginning (but not anywhere else). Make sure you check the examples given. A list of sentences in Pig Latin. Each sentence should be on a new line and should not contain punctuation, but it should start with a capital letter. #cf_span(class=[tex-font-style-underline], body=[Constraints]): 1 ≤ T ≤ 20 Each sentence will not contain punctuation and will be all lowercase English characters, except for the very first letter of the very first word, which will be an uppercase English character. ## Input The first line will contain an integer T, where T is the number of sentences given. Each sentence will be on a new line and will not contain punctuation. However, they will be capitalised at the beginning (but not anywhere else). Make sure you check the examples given. ## Output A list of sentences in Pig Latin. Each sentence should be on a new line and should not contain punctuation, but it should start with a capital letter. [samples] ## Note #cf_span(class=[tex-font-style-underline], body=[Constraints]):1 ≤ T ≤ 20Each sentence will not contain punctuation and will be all lowercase English characters, except for the very first letter of the very first word, which will be an uppercase English character.
**Definitions** Let $ T \in \mathbb{Z} $ be the number of sentences. Let $ S = \{s_1, s_2, \dots, s_T\} $ be the set of input sentences, where each $ s_i $ is a string composed of lowercase English letters, except the first character of the first word, which is uppercase. **Constraints** 1. $ 1 \leq T \leq 20 $ 2. Each sentence contains no punctuation. 3. Each sentence has exactly one uppercase letter: the first character of the first word. All other letters are lowercase. **Objective** For each sentence $ s_i $, convert it to Pig Latin as follows: - Split $ s_i $ into words $ w_1, w_2, \dots, w_m $. - For each word $ w $: - If $ w $ has length 1: transform to $ w + \text{"ay"} $. - If $ w $ has length $ \geq 2 $: - Move the first letter to the end. - Append "ay". - Capitalize the first letter of the first word of the resulting sentence. - Output the transformed sentence as a single string with words separated by spaces. Output $ T $ lines, each being the Pig Latin transformation of the corresponding input sentence.
API Response (JSON)
{
  "problem": {
    "name": "C. Pig Latin",
    "description": {
      "content": "https://en.wikipedia.org/wiki/Pig_Latin Pig Latin is a secret language which is similar to English. To convert an English word to Pig Latin, take the first letter of that word, move it to the end, an",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10206C"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "https://en.wikipedia.org/wiki/Pig_Latin\n\nPig Latin is a secret language which is similar to English. To convert an English word to Pig Latin, take the first letter of that word, move it to the end, an...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of sentences.  \nLet $ S = \\{s_1, s_2, \\dots, s_T\\} $ be the set of input sentences, where each $ s_i $ is a string composed of lowercase Englis...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments