Implement class Segments

Use Segments instead of concrete type vector<string> for higher
abstraction