Java String Tokens Hackerrank Solution In C