We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

The solution is based on sorting and counting distinct values using wc i.e word count. So for instance, if you have input as 2,2,1 the value of variable c would be 2 since it counts both these 2's as a single 2 alongwith 1. So logically your input 2,2,1 becomes 2,1 and word count gives you a count of distinct lines and thus variable c holds a value of 2 and thus its isoceles.
And if the input is 3,3,3 then all these 3's are counted once and then the wc command would return the value of variable c as 1 and thus it would be equilateral.

## More on Conditionals

You are viewing a single comment's thread. Return to all comments →

can you please explain this?

The solution is based on sorting and counting distinct values using wc i.e word count. So for instance, if you have input as 2,2,1 the value of variable c would be 2 since it counts both these 2's as a single 2 alongwith 1. So logically your input 2,2,1 becomes 2,1 and word count gives you a count of distinct lines and thus variable c holds a value of 2 and thus its isoceles. And if the input is 3,3,3 then all these 3's are counted once and then the wc command would return the value of variable c as 1 and thus it would be equilateral.

This is perhaps the best solution which beats my solution. Thanks for sharing it :)