package main import ( "fmt" "strings" ) func main() { // Use a map to store the unique URL directories we find dirs := make(map[string]bool) // Read the URLs from standard input var url string for { // Read the next URL _, err := fmt.Scanln(&url) if err != nil { break } // Extract the directory from the URL parts := strings.Split(url, "/") dir := strings.Join(parts[:len(parts)-1], "/") // Add the directory to our map if it's not already there if !dirs[dir] { dirs[dir] = true fmt.Println(dir) } } }