Java String Tokens Hackerrank Solution For C