add java solution for beautiful_strings