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 8f788a3830 Update README.md 2 years ago
..
README.md Update README.md 2 years ago

README.md

swap-name

Instructions

Write a program that takes two words in the first argument and swaps them.

  • If the number of arguments is not 2, nothing should be printed.
  • the first argument should containe only alphabitic characters and spaces, if not, print "Error\n"
  • Skip the spaces only in the first word of the first argument.
    • Print the result with a new line at the end ('\n').

Usage

$ go run . | cat -e
$ go run . "Hello World" "Hello World" | cat -e
$ go run . "Hello World" | cat -e
World Hello$
$ go run . "He2 $%hello" | cat -e
Error$
$ go run . "   Hello World" | cat -e
World Hello$
$ go run . "Hello World   " | cat -e
Error$
$ go run . "Hello World Hello" | cat -e
Error$