how to understand Line 67: undefined: strings in strings.Trim

  • 0

    this code can run on my PC. But the oj tell us a compile error:Line 67: undefined: strings in strings.Trim
    As a beginner in golang, I dont know how to deal with it. Everything will be appreciated.
    My code as follow:

    import "fmt"
    import ss "strings"

    func reverseWords(s string) string {
    words := ss.Split(s," ");
    res := "";
    for i:=0; i < len(words);i++{
    curWord := ss.Split(words[i],"");
    for j:=len(curWord)-1; j >= 0;j--{
    res += curWord[j];
    res += " ";
    return res;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.