Coding Practice - 20 Split the Sentence
Split the Sentence
Given a list of N words, write a program to print each word in a line.
Input
The first line of input will contain space-separated words, denoting the elements of the list.
Output
The output should be N lines containing each word in a new line in the given order.
Explanation
For example, if the given sentence is the following.
Your code should print each word in a new line. So the output should be
Input
The first line of input will contain space-separated words, denoting the elements of the list.
Output
The output should be N lines containing each word in a new line in the given order.
Explanation
For example, if the given sentence is the following.
Banana Apple Pomegranate Strawberry Grapes Orange
Your code should print each word in a new line. So the output should be
Banana
Apple
Pomegranate
Strawberry
Grapes
Orange
Sample Input 1Sample Output 1
Banana Apple Pomegranate Strawberry Grapes Orange
Banana Apple Pomegranate Strawberry Grapes Orange
Sample Input 2Sample Output 2
Cricket Hockey Football Badminton Tennis Basketball Golf Volleyball Archery Boxing
Cricket Hockey Football Badminton Tennis Basketball Golf Volleyball Archery Boxing
code:
a= input()
w= a.split()
for word in w:
print(word)
Comments
Post a Comment