Determine whether three side lengths can form a triangle, and if so, classify the triangle by its side equality.
Problem
You are given three positive integers representing the lengths of three segments.
Determine whether these segments can form a non-degenerate triangle. If they can, classify the triangle as:
- Equilateral: all three sides are equal
- Isosceles: exactly two sides are equal
- Scalene: all sides are different
If the segments cannot form a triangle, report that it is Impossible.
A triangle is valid only if the sum of any two side lengths is strictly greater than the third side.
Input Format
- One line containing three integers , , and .
- The three values represent the lengths of the segments.
Output Format
Print one of the following:
EquilateralIsoscelesScaleneImpossible
Constraints
- Use the strict triangle inequality: each pair of sides must sum to more than the third side.
Example 1
Input
3 4 5
Output
Scalene
Explanation
The sides satisfy the triangle inequality, and all three lengths are different.
Example 2
Input
2 2 3
Output
Isosceles
Explanation
The three sides can form a triangle, and exactly two sides are equal.
Show 1 more example
Example 3
Input
1 2 3
Output
Impossible
Explanation
The sum of the two smaller sides is not greater than the largest side.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.