Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103(削除) 103 (削除ここまで) 101 bytes
((#)=<<length=<<k).map lengthk.lines;1#x=0;l#x|x==[1lines;k=length;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum[1|z<1]=3;l#x=k[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.
Edit: -2 bytes thanks to Lynn !
Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103 bytes
((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.
Haskell, (削除) 113 (削除ここまで) 107(削除) 107 (削除ここまで) 103 bytes
((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum
[1|z<1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.
Haskell, (削除) 113 (削除ここまで) 107 bytes
((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum
[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.
Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103 bytes
((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.
Haskell, 113(削除) 113 (削除ここまで) 107 bytes
((#)=<<length).map length.lines;1#x=
3;l#x@(y:_)|x==[1
lines;1#x=0;l#x|x==[1..l]||x==[ll]
||x==[l,l-1..
1]=2|all(==l)x=0|1]=3;l#x=sum
[1|z<-[l,x!!0],all(==y==z)x=1;_#_=3x]
Returns 0, 1, 2 and 3 for squaremess, rectangle, trianglesquare and messtriangle, respectively.
Haskell, 113 bytes
((#)=<<length).map length.lines;1#x=
3;l#x@(y:_)|x==[1
..l]||x==[l,l-1..
1]=2|all(==l)x=0|
all(==y)x=1;_#_=3
Returns 0, 1, 2 and 3 for square, rectangle, triangle and mess, respectively.
Haskell, (削除) 113 (削除ここまで) 107 bytes
((#)=<<length).map length.
lines;1#x=0;l#x|x==[1..l]
||x==[l,l-1..1]=3;l#x=sum
[1|z<-[l,x!!0],all(==z)x]
Returns 0, 1, 2 and 3 for mess, rectangle, square and triangle, respectively.