Psychic powers is solved using regex in java