|
|
@ -4,7 +4,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
Write a program that takes two words in the first argument and swaps them. |
|
|
|
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 number of arguments is not 2, nothing should be printed. |
|
|
|
- If the first argument is not a string, the program should print `"Error\n"`. |
|
|
|
- If the first argument is not an alphanumeric characters, the program should print `"Error\n"`. |
|
|
|
- Skip the spaces in the first of the two words. |
|
|
|
- Skip the spaces in the first of the two words. |
|
|
|
- Print the result with a new line at the end (`'\n'`). |
|
|
|
- Print the result with a new line at the end (`'\n'`). |
|
|
|
|
|
|
|
|
|
|
@ -23,4 +23,4 @@ $ go run . "Hello World " | cat -e |
|
|
|
Error$ |
|
|
|
Error$ |
|
|
|
$ go run . "Hello World Hello" | cat -e |
|
|
|
$ go run . "Hello World Hello" | cat -e |
|
|
|
Error$ |
|
|
|
Error$ |
|
|
|
``` |
|
|
|
``` |
|
|
|