Ruby, 97 bytes
m=$<.lines.map{|l|l.chomp.size}.sort;r=[*1..s=m.
size];p s<2?4:m[0]==m[-1]? s==m[0]?1:2:r==m ?3:4
Output:
- 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