Making Anagrams

package main
import "fmt"

func main() {
 //Enter your code here. Read input from STDIN. Print output to STDOUT
        var s1, s2 string
    fmt.Scanln(&s1)
    fmt.Scanln(&s2)
    arr1 := make([]int, 26)
    //arr2 := make([]int, 26)
    for _, val := range s1 {
        arr1[val-'a']++
    }
    for _, val := range s2 {
        arr1[val-'a']--
    }
    var sum int
    for _, val := range arr1 {
        if val < 0 {
            sum -= val
        } else {
            sum += val
        }
    }
    fmt.Println(sum)
}

你可能感兴趣的:(Making Anagrams)