c++ solution
\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& a, string s) {\n        vector<int>v;\n        int count,x,y;\n        int 
```\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& a, string s) {\n        vector<int>v;\n        int count,x,y;\n        int m=s.size();\n        for(int j=0;j<m;j++){\n            count=0;\n             x=a[0],y=a[1];\n            for(int i=j;i<m;i++){\n               if(s[i]==\'R\')\n                   y++;\n              else if(s[i]==\'L\')\n                   y--;\n               else if(s[i]==\'U\')\n                    x--;\n                else\n                    x++;\n                if(x>=0 && x<n && y>=0 && y<n)\n                    count++;\n                else\n                    break;\n            }\n            v.push_back(count);\n        }\n        return v;\n    }\n};\n```
['String', 'C']