package main
import (
"fmt"
)
func printChar(ch chan string, char string) {
for i := 0; i < 5; i++ {
<-ch
fmt.Print(char + " ")
ch <- "done"
}
}
func main() {
ch1 := make(chan string)
ch2 := make(chan string)
ch3 := make(chan string)
go printChar(ch1, "a")
go printChar(ch2, "b")
go printChar(ch3, "c")
ch1 <- "start"
for i := 0; i < 5; i++ {
<-ch1
ch2 <- "start"
}
<-ch2
for i := 0; i < 5; i++ {
<-ch2
ch3 <- "start"
}
<-ch3
for i := 0; i < 5; i++ {
ch1 <- "start"
<-ch3
}
}