C++ easiest solutin
\nclass OrderedStream {\npublic:\n    vector<string> stream ; //to get input\n    int i=0;\n    OrderedStream(int n) {\n        stream.resize(n); //change the s
```\nclass OrderedStream {\npublic:\n    vector<string> stream ; //to get input\n    int i=0;\n    OrderedStream(int n) {\n        stream.resize(n); //change the size of the vector when orderedStream is called\n    }\n    \n    vector<string> insert(int id, string value) {\n        vector<string> result;\n        stream[id-1] = value; // value is stored in the ith position\n        while(i<stream.size() && stream[i]!="") //stream[i] !="" because an entry is printed only if the entry before it is printed\n        {\n            result.push_back(stream[i]);\n            i++;\n        }\n        return result;\n    }\n};\n\n/**\n * Your OrderedStream object will be instantiated and called as such:\n * OrderedStream* obj = new OrderedStream(n);\n * vector<string> param_1 = obj->insert(id,value);\n */\n```
['C', 'C++']