# [557\. 反转字符串中的单词 III](https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/)
![](https://box.kancloud.cn/a8e22faeda1a116543e4139cd7309671_632x145.png)
### 解法1
```
func reverseWords(s string) string {
data := ""
split := strings.Split(s, " ")
end := len(split)-1
for k,v := range split {
i := desc(v)
if k != end {
data += i + " "
}else{
data += i
}
}
return data
}
func desc(s string) string {
data := ""
for i:=len(s)-1;i>=0;i-- {
data += string(s[i])
}
return data
}
```
### 解法二