|
|
@ -1,27 +1,24 @@ |
|
|
|
## Weareunique |
|
|
|
## weareunique |
|
|
|
|
|
|
|
|
|
|
|
### Instructions |
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
|
|
Write a function that takes two strings and returns the number of characters that are not included in both, without doubles. |
|
|
|
Write a function that takes two strings and returns the number of characters that are not included in both, without doubles. |
|
|
|
- If there is no unique charachters return 0. |
|
|
|
- If there is no unique characters return `0`. |
|
|
|
- If both strings are empty return -1. |
|
|
|
- If both strings are empty return `-1`. |
|
|
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
### Expected function |
|
|
|
|
|
|
|
|
|
|
|
```go |
|
|
|
```go |
|
|
|
|
|
|
|
func WeAreUnique(str1 , str2 string) int { |
|
|
|
func Weareunique(str1 , str2 string) int { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
### Usage |
|
|
|
### Usage |
|
|
|
|
|
|
|
|
|
|
|
Here is a possible program to test your function : |
|
|
|
Here is a possible program to test your function: |
|
|
|
|
|
|
|
|
|
|
|
```go |
|
|
|
```go |
|
|
|
|
|
|
|
|
|
|
|
package main |
|
|
|
package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
@ -29,24 +26,23 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
func main() { |
|
|
|
|
|
|
|
|
|
|
|
arr := [][]string{ |
|
|
|
arr := [][]string{ |
|
|
|
{"foo", "boo"}, |
|
|
|
{"foo", "boo"}, |
|
|
|
{"",""}, |
|
|
|
{"", ""}, |
|
|
|
{"abc", "def"}, |
|
|
|
{"abc", "def"}, |
|
|
|
{"hello", "yoall"}, |
|
|
|
{"hello", "yoall"}, |
|
|
|
{"everyone", ""}, |
|
|
|
{"everyone", ""}, |
|
|
|
{"hello world", "fam"}, |
|
|
|
{"hello world", "fam"}, |
|
|
|
{"pomme","pomme"}, |
|
|
|
{"pomme", "pomme"}, |
|
|
|
{"", "exam"}, |
|
|
|
{"", "exam"}, |
|
|
|
} |
|
|
|
} |
|
|
|
for _, v := range arr { |
|
|
|
for _, v := range arr { |
|
|
|
fmt.Println(Weareunique(v[0], v[1])) |
|
|
|
fmt.Println(WeAreUnique(v[0], v[1])) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
And its output : |
|
|
|
And its output: |
|
|
|
|
|
|
|
|
|
|
|
```console |
|
|
|
```console |
|
|
|
$ go run . |
|
|
|
$ go run . |
|
|
|