Hackerrank – Find Hackerrank

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Print “0” if the input matches ^hackerrank$ or ^hackerrank.*hackerrank$
Print “1” if the input matches ^hackerrank.*
Print “2” if the input matches .*hackerrank$
else print “-1”

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby