algorithm – find the biggest word in the chain

I wrote code in Go Language. I wonder if anyone does it in a very simple and effective way because each language has its own way of solving the problem. My experience in JavaScript. Thank you for guiding me to improve this solution. Thank you in advance.

So, what am I doing here.

Contribution –

  • "I like dogs"
  • "fun & !! time"

Exit: –

Here, I return the biggest word in the chain. If there are two or more
words of the same length return the first word in the string
with this length

main package

import (
"Fmt"
"Regex"
)

func main () {
re: = regexp.MustCompile (`[A-Za-z]+ |[*?()$&.,!]`)
corresponds to: = re.FindAllString ("fun & !! time", -1)
var count int
for i: = 0; I < len(matches); i++ {

            if (i+1)%len(matches) > 0 {

if len (corresponds[(i+1)%len(matches)])> len (matches[i]) {
number = (i + 1)% len (matches)

}

}

}
fmt.Println (corresponds[count])
}

What's your biggest pet peeve?

Report abuse

Additional details