Exercise: Maps
来源:互联网 发布:注会 0基础 知乎 编辑:程序博客网 时间:2024/05/19 19:32
Go官网关于map的一个练习。分割一个句子,统计每个单词出现的次数。
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
temp:=strings.Split(s," ")
m:=make(map[string]int)
for _,value:=range temp{
m[value]++
}
return m
}
func main() {
wc.Test(WordCount)
}
阅读全文
0 0
- Exercise: Maps
- go语言Exercise: Maps
- Exercise
- exercise
- Exercise
- exercise
- maps
- maps
- Maps
- Exercise 4.2 Exercise 4.3
- Exercise------------ProgUseJava
- Exercise 1.16
- exercise 1.17
- exercise 1.19
- exercise CombinationNoNeighboring
- exercise permutation
- Exercise: WindowsAzureRoleCommunicationVS2010Lab
- python exercise
- zabbix客户端端部署 for CentOS7
- 删
- xml school
- easyuidatagrid中load,reload,loadData的区别。
- 权限管理框架Shiro学习
- Exercise: Maps
- MATLAB做曲线拟合
- SpringBoot 入门
- 多个 gradle 文件夹 \.gradle\wrapper\dists\ 设置gradle不是每次都下载
- AF_NetLink结构体及例程
- 【postman简介】
- 【mybatis】批量insert数据
- 经典动态规划的迭代条件
- 金蝶K3 SQL报表系列-生产在线材料查询