Learn to Code by Solving Problems: A Python Programming Primer Homepage for the book Learn to Code by Solving Problems: A Python Programming Primer

Can You Solve This Using Only Chapter 1?

Here’s a problem I recently gave my students. Can you solve it using only Chapter 1 of Learn to Code by Solving Problems?

Fix Dan’s Sentences

Dan’s writing a new book, but he needs a bit of help with his grammar. Correct the given sentences by adding commas in the correct locations throughout the sentence.

Input

For example, the sentence Dinner is chocolate, goldfish and mustard. is a valid input, and so is TAs like code exams tests essays and grading.

Output

Output the sentence with one comma after each noun (nouns in this problem are the words indicated above in the input section). Do not add or modify anything else about the given sentence.

For example, given the input TAs like code exams tests essays and grading. , your code should output TAs like code, exams, tests, essays, and grading.

Requirements

Sample Input 1

Ruth eats apples oranges, kiwis and bananas.

Sample Output 1

Ruth eats apples, oranges, kiwis, and bananas.

Sample Input 2

Parvati reads books and code.

Sample Output 2

Parvati reads books, and code.