DMPG '17 B2 - Yoda

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Talk like this, Yoda does. Hard to understand, this may be. If given a sentence you are, convert it into English can you? Since difficult this may be, bend the rules of English grammar you may.

Yoda-Speak English
Talk like this, Yoda does. Yoda does talk like this.
Hard to understand, this may be. This may be hard to understand.
If given a sentence you are, convert it into English can you? Convert it into English can you if given a sentence you are?
Since difficult this may be, bend the rules of English grammar you may. Bend the rules of English grammar you may since difficult this may be.

Input Specification

The input will be a single string S, with length no longer than 1\,000. It will not start with a lowercase letter, and finish with either a period (.), question mark (?), or exclamation mark (!). Additionally, there will only be a single comma within the string.

Output Specification

The converted string.

Sample Input 1

Speak like this, Yoda does.

Sample Output 1

Yoda does speak like this.

Sample Input 2

English, a language it is.

Sample Output 2

A language it is english.

Sample Input 3

Comma at the end,!

Sample Output 3

Comma at the end!

Comments


  • 2
    ross_cleary  commented on April 15, 2020, 6:28 p.m.

    The rules for converting the string and the constraints on the string need to be much more clear in the statement. There are many questions that are left unanswered, such as whether all sequences of characters are separated by exactly one space, if and what to do if capital letters are in the middle of the string, and it would also be helpful to know that the string can contain characters that are not letters of the alphabet.


    • -1
      Narcariel  commented on April 16, 2020, 5:11 p.m.

      How did you do the last two cases?


      • 2
        ross_cleary  commented on April 17, 2020, 1:33 a.m.

        That's a bit of a strange question because, I did not 'do' any of the test cases, I wrote one code. But in terms of things you should look for in your code to potentially help pass the last two test cases, refer to the points I made about edge cases that are not made clear to be possible in the problem statement.