← Home
```go
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	s, _ := reader.ReadString('\n')
	s = strings.TrimSpace(s)
	
	if isDomain(s) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func isDomain(s string) bool {
	if len(s) == 0 {
		return false
	}
	
	if s[0] == '.' || s[len(s)-1] == '.' {
		return false
	}
	
	hasDot := false
	prevDot := false
	
	for i := 0; i < len(s); i++ {
		c := s[i]
		
		if c == '.' {
			if prevDot {
				return false
			}
			prevDot = true
			hasDot = true
		} else {
			prevDot = false
			if !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
				return false
			}
		}
	}
	
	if !hasDot {
		return false
	}
	
	lastDotIndex := strings.LastIndex(s, ".")
	lastPart := s[lastDotIndex+1:]
	if len(lastPart) != 2 && len(lastPart) != 3 {
		return false
	}
	
	return true
}
```