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.
 
 
 
 
 
 

25 lines
368 B

package main
import (
"fmt"
"os"
"strings"
)
func result(s1 string, s2 string) string {
var rest []rune
for _, a := range s1 {
for _, b := range s2 {
if a == b && !strings.ContainsRune(string(rest), a) {
rest = append(rest, a)
}
}
}
return string(rest)
}
func main() {
if len(os.Args) == 3 {
fmt.Println(result(os.Args[1], os.Args[2]))
}
}