> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/c/cheryls_birthday.md).

# Cheryl's birthday

```ruby
func f(day, month) {
    Date.parse("#{day} #{month}", "%d %B")
}

var dates = [
    f(15, "May"),
    f(16, "May"),
    f(19, "May"),
    f(17, "June"),
    f(18, "June"),
    f(14, "July"),
    f(16, "July"),
    f(14, "August"),
    f(15, "August"),
    f(17, "August")
]

var filtered = dates.grep {
    dates.grep {
        dates.map{ .day }.count(.day) == 1
    }.map{ .month }.count(.month) != 1
}

var birthday = filtered.grep {
    filtered.map{ .day }.count(.day) == 1
}.group_by{ .month }.values.first_by { .len == 1 }[0]

say "Cheryl's birthday is #{birthday.fullmonth} #{birthday.day}."
```

## Output:

```
Cheryl's birthday is July 16.
```
