Hoarding programming problems for you!

Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Polygons challenge

Sharing is caring!

Problem statement
Identify whether four sides (given by four integers) can form a square, a rectangle, or neither.

Input
You will receive an list of strings, each containing four space-separated integers, which represent the length of the sides of a polygon. The input lines will follow the ‘A B C D’ order as in the following representation:

Output
A single line which contains 3 space-separated integers; representing the number of squares, number of rectangles, and number of other polygons with 4 sides. Note that squares shouldn’t be counted as rectangles. Invalid polygons should also be counted as ‘other polygons’.

Constraints
The four integers representing the sides will be such that: -2000 \le x \le 2000 (Where x represents the integer)

Sample Input

Sample Output

Solution