Browse Source

Update README.md

1138-swap-name
Hamza elkhatri 2 years ago committed by GitHub
parent
commit
07034381da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      subjects/swapname/README.md

10
subjects/swapname/README.md

@ -4,9 +4,9 @@
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 contain only alphabetic characters and spaces, if not, print `"Error\n"`
- Skip the spaces only in the first word of the first argument.
- The first argument should contain only alphabetic characters and spaces and only two word, if not, print `"Error\n"`
- Print the result with a new line at the end (`'\n'`).
- Trim space in the beginning and end of the string
### Usage
@ -17,10 +17,10 @@ $ go run . "Hello World" | cat -e
World Hello$
$ go run . "He2 $%hello" | cat -e
Error$
$ go run . " Hello World" | cat -e
$ go run . " Hello World " | cat -e
World Hello$
$ go run . "Hello World " | cat -e
Error$
$ go run . "Hello World Hello" | cat -e
Error$
$ go run . "Hello" | cat -e
Error$
```

Loading…
Cancel
Save