You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Hamza elkhatri 21a3749dcc Update README.md 2 years ago
..
README.md Update README.md 2 years ago

README.md

swap-name

Instructions

Write a program that takes a first and last name as one argument and swaps them.

  • If there is more than one argument, nothing should be printed.
  • The argument should contain only alphabetic characters and spaces and only two words, if not, you have to print "Error\n"
  • The result must be followed with a new line at the end ('\n').
  • Trim any extra spaces in the string.

Usage

$ go run . | cat -e
$ go run . "James Carl" "Peter Lab" | cat -e
$ go run . "ROB carlos" | cat -e
carlos ROB$
$ go run . "He2 $%hello" | cat -e
Error$
$ go run . "    JULIE BIRD   " | cat -e
BIRD JULIE$
$ go run . "Carl Jon Mic" | cat -e
Error$
$ go run . "ROB" | cat -e
Error$
$ go run . "ROB       FASEM" | cat -e
FASEM ROB$