C++ | EASY IMPLEMENTATION
```\nclass Solution {\npublic:\n    vector executeInstructions(int n, vector& startPos, string s) {\n        int m = s.size();\n        vector ans(m);\n        
```\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        int m = s.size();\n        vector<int> ans(m);\n        for(int i=0; i<m; i++)\n        {\n            int x = startPos[0];\n            int y = startPos[1];\n            int count  = 0;\n            for(int j=i; j<m; j++)\n            {\n                char c = s[j];\n                if(c==\'L\')\n                {\n                    if(y==0)\n                        break;\n                    else y--;\n                }\n                if(c==\'R\')\n                {\n                    if(y==n-1)\n                        break;\n                    else y++;\n                }\n                if(c==\'U\')\n                {\n                    if(x==0)\n                        break;\n                    else x--;\n                }\n                if(c==\'D\')\n                {\n                    if(x==n-1)\n                        break;\n                    else x++;\n                }\n                count++;\n            }\n            ans[i] = count;\n        }\n        return ans;\n    }\n};
['C']