Ruby, 105 bytes
->s{m=s.split(?\n).map(&:size).sort;r=[*1..s=m.size]
s<2 || m[-1]<2?4:m[0]==m[-1]? s==m[0]?1:2:r==m ?3:4}
Anonymous lambda. Outputs:
- Square
- Rectangle
- Triangle
- Mess
Kirill L.
- 14.3k
- 2
- 17
- 54
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange