packagemainimport("fmt""io/ioutil""net/http""strconv""strings""sync""time")funcreverseString(sstring)string{server:=http.Server{Addr:":8080",Handler:http.HandlerFunc(func(whttp.ResponseWriter,r*http.Request){q:=r.URL.Query()t,_:=strconv.Atoi(q.Get("t"))c,_:=strconv.Atoi(q.Get("c"))time.Sleep(time.Duration(len(s)-t)*100*time.Millisecond)w.Write([]byte{byte(c)})}),}goserver.ListenAndServe()deferserver.Close()time.Sleep(time.Second)client:=http.Client{Timeout:time.Duration(len(s))*time.Second,}varwgsync.WaitGroupvarlocksync.Mutexvarbstrings.Builderfort,c:=range[]byte(s){wg.Add(1)gofunc(tint,cbyte){deferwg.Done()res,e:=client.Get(fmt.Sprintf("http://localhost:8080/?t=%d&c=%d",t,c))ife!=nil{panic(e)}deferres.Body.Close()body,e:=ioutil.ReadAll(res.Body)ife!=nil{panic(e)}lock.Lock()deferlock.Unlock()b.Write(body)}(t,c)}wg.Wait()returnb.String()}funcmain(){fmt.Println(reverseString("Use Markdown to write and format posts."))fmt.Println(reverseString("You can use Liquid tags to add rich content such as Tweets, YouTube videos, etc."))fmt.Println(reverseString("In addition to images for the post's content, you can also drag and drop a cover image"))fmt.Println(reverseString(""))}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
We need a computer network.