Browse Source

subject(swapName):add readme

1138-swap-name
hamza 2 years ago
parent
commit
17c1961804
  1. 26
      subjects/swapname/README.md

26
subjects/swapname/README.md

@ -0,0 +1,26 @@
## 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.
- If the first argument is not a string, the program should print `"Error\n"`.
- Skip the spaces in the first of the two words.
- Print the result with a new line at the end (`'\n'`).
### Usage
```console
$ 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$
```
Loading…
Cancel
Save