You should look into Strings and comparing portions. You don't need recursion for this, you can simply do this using if else statements.