Files
LeetCode-Go/leetcode/0058.Length-of-Last-Word/58.Length of Last Word_test.go
2021-09-15 17:04:01 +08:00

51 lines
673 B
Go

package leetcode
import (
"fmt"
"testing"
)
type question58 struct {
para58
ans58
}
// para 是参数
type para58 struct {
s string
}
// ans 是答案
type ans58 struct {
ans int
}
func Test_Problem58(t *testing.T) {
qs := []question58{
{
para58{"Hello World"},
ans58{5},
},
{
para58{" fly me to the moon "},
ans58{4},
},
{
para58{"luffy is still joyboy"},
ans58{6},
},
}
fmt.Printf("------------------------Leetcode Problem 58------------------------\n")
for _, q := range qs {
_, p := q.ans58, q.para58
fmt.Printf("【input】:%v 【output】:%v\n", p, lengthOfLastWord(p.s))
}
fmt.Printf("\n\n\n")
}