Go: Weekday or weekend

A switch with grouped cases is the tidy way to sort values into kinds.

What to build

A program that classifies day names.

Requirements

  • Read n, then n words in lower case.
  • For monday to friday print weekday; for saturday and sunday print weekend; for any other word print unknown.

Input

Line 1: n. Then n words.

Output

n lines.

Constraints

1 ≤ n ≤ 50; words are lower case letters, 1 to 12 long.

Example

Input:

3
monday saturday holiday

Output:

weekday
weekend
unknown

Why it works

Each case lists every value that belongs to the group, so the five weekdays share one block and the two weekend days share another. default catches everything else.

Examples

Example 1 · Input
3
monday saturday holiday
Expected output
weekday
weekend
unknown
Example 2 · Input
2
friday sunday
Expected output
weekday
weekend

Hints

Hint 1

Use switch with several values in a case: case "saturday", "sunday":.

Hint 2

Do not forget default for names that are not days.

Solution

Show one correct solution (try it yourself first)
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var day string
		fmt.Scan(&day)
		switch day {
		case "monday", "tuesday", "wednesday", "thursday", "friday":
			fmt.Println("weekday")
		case "saturday", "sunday":
			fmt.Println("weekend")
		default:
			fmt.Println("unknown")
		}
	}
}

▶ Open this solution in the compiler

Lesson: Conditions and switch →