Cpp Solution
\nclass OrderedStream {\n    vector<string> strm;\n    int cptr = 0;\npublic:\n    OrderedStream(int n) {\n        strm.resize(n);\n    }\n    \n    vector<stri
```\nclass OrderedStream {\n    vector<string> strm;\n    int cptr = 0;\npublic:\n    OrderedStream(int n) {\n        strm.resize(n);\n    }\n    \n    vector<string> insert(int idKey, string value) {\n        strm[idKey - 1] = value;\n        vector<string> rstrm;\n        while(cptr < strm.size() and strm[cptr] != "")\n            rstrm.push_back(strm[cptr++]);\n        return rstrm;\n    }\n};\n\n```
[]