First (and) last name

Report a typo

Write a program that will search for mentions of names (both single names and full names) in the text. If the text contains a name and surname one immediately followed by the other, it should be one match. That is, the name we need to find is either only one word or two words located one after the other (the first and last names of a person).

In this task, first and last names are words beginning with a capital letter.

See the example for better understanding of the task.

Sample Input 1:

Jack, Smith and John Bull are walking together today.

Sample Output 1:

Jack
Smith
John Bull
Write a program in Kotlin
fun main() {
// write your code here

}
___

Create a free account to access the full topic