Traveloka Interview Question

Tree, Simple string detection logic