Given a string `s`, determine if it is **valid**.

A string `s` is **valid** if, starting with an empty string `t = " "`, you can **transform** `t` **into** `s` after performing the following operation **any number of times**:

*   Insert string `"abc "` into any position in `t`. More formally, `t` becomes `tleft + "abc " + tright`, where `t == tleft + tright`. Note that `tleft` and `tright` may be **empty**.

Return `true` _if_ `s` _is a **valid** string, otherwise, return_ `false`.

**Example 1:**

**Input:** s =  "aabcbc "
**Output:** true
**Explanation:**
 " " ->  "abc " ->  "aabcbc "
Thus,  "aabcbc " is valid.

**Example 2:**

**Input:** s =  "abcabcababcc "
**Output:** true
**Explanation:**
 " " ->  "abc " ->  "abcabc " ->  "abcabcabc " ->  "abcabcababcc "
Thus,  "abcabcababcc " is valid.

**Example 3:**

**Input:** s =  "abccba "
**Output:** false
**Explanation:** It is impossible to get  "abccba " using the operation.

**Constraints:**

*   `1 <= s.length <= 2 * 104`
*   `s` consists of letters `'a'`, `'b'`, and `'c'`


from collections import defaultdict
from math import sqrt, inf


def minAreaFreeRect(points):
    minArea = inf
    xGroups = defaultdict(set)

    for x, y in points:
        xGroups[x].add(y)

    for x1, ys1 in xGroups.items():
        for x2, ys2 in xGroups.items():
            if x1 == x2:
                continue

            for y1 in ys1:
                for y2 in ys2:
                    if y2 in ys1 and y1 in ys2:
                        area = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) * sqrt((x1 - x2) ** 2 + (y1 - y1) ** 2)
                        minArea = min(minArea, area)

    return minArea if minArea != inf else 0
