A string is considered to be square if the following conditions are met:
- Each line has the same number of characters
- The number of characters on each line is equal to the number of lines.
Your task is to write a program or function which determines whether or not a given input string is a square.
You may require input to be delimited by your choice of LF, CR, or CRLF.
The newline character(s) are not considered part of the line's length.
You may require there to be or to not be a trailing newline in input, which doesn't count as an additional line.
Input is a string or 1D char array; it is not a list of strings.
You may assume input is non-empty and only contains printable ASCII, including spaces.
You must output a truthy value for square strings and a falsy one for other strings.
Truthy test cases:
foo bar baz
.
.s. .ss .s. (s represents space)
ss ss (s represents space)
aaaaa aaaaa aaaaa aaaaa aaaaa
Falsy test cases:
.. .
.
.
.... ....
4444 333 22
333 333
abc.def.ghi
Note extra blank lines in some of the falsy cases.
This is code-golf - fewest bytes wins!