Easy Cpp Solution ✅✅
\nclass Solution {\npublic:\n    bool checkFreq(string start,string target)\n    {\n        int a1=0,a2=0,a3=0,b1=0,b2=0,b3=0;\n        for(int i=0;i<start.size
```\nclass Solution {\npublic:\n    bool checkFreq(string start,string target)\n    {\n        int a1=0,a2=0,a3=0,b1=0,b2=0,b3=0;\n        for(int i=0;i<start.size();i++)\n        {\n            if(start[i]==\'L\')a1++;\n            if(start[i]==\'R\')a2++;\n            if(start[i]==\'_\')a3++;\n            \n            if(target[i]==\'L\')b1++;\n            if(target[i]==\'R\')b2++;\n            if(target[i]==\'_\')b3++;\n            \n        }\n        return a1==b1&&a2==b2&&a3==b3;\n    }\n    bool canChange(string start, string target) {\n        // Check if number of dashes L and R are equal\n        if(checkFreq(start,target)==false)return false;\n        \n        vector<int>prevR;\n        vector<int>afterL;\n        \n        vector<int>prevR1;\n        vector<int>afterL1;\n        \n        //Checking if number of R before every L in start and target are same or not\n        int count1=0,count2=0;                 \n        for(int i=0;i<start.size();i++)\n        {\n            if(start[i]==\'R\')count1++;\n            if(start[i]==\'L\')prevR.push_back(count1);\n            \n            if(target[i]==\'R\')count2++;\n            if(target[i]==\'L\')prevR1.push_back(count2);\n            \n        }\n        for(int i=0;i<prevR.size();i++)\n        {\n            if(prevR1[i]!=prevR[i])return false;\n        }\n        \n        //Checking if number of L after every R in start and target are same or not\n        count1=0;count2=0;        \n        for(int i=start.size()-1;i>=0;i--)\n        {\n            if(start[i]==\'L\')count1++;\n            if(start[i]==\'R\')afterL.push_back(count1);\n            \n            if(target[i]==\'L\')count2++;\n            if(target[i]==\'R\')afterL1.push_back(count2);            \n        }\n        for(int i=0;i<afterL1.size();i++)\n        {\n            if(afterL1[i]!=afterL[i])return false;\n        }\n        \n//     Checking if number if dashes before every L are >= than that in target\n        vector<int>prevDashesStart;\n        vector<int>afterDashesStart;\n        vector<int>prevDashesTarget;\n        vector<int>afterDashesTarget;        \n        count1=0;count2=0;\n        for(int i=0;i<start.size();i++)\n        {\n            if(start[i]==\'_\')count1++;\n            if(start[i]==\'L\')prevDashesStart.push_back(count1);\n            \n            if(target[i]==\'_\')count2++;\n            if(target[i]==\'L\')prevDashesTarget.push_back(count2); \n        }\n        for(int i=0;i<prevDashesStart.size();i++)\n        {\n            if(prevDashesStart[i]<prevDashesTarget[i])return false;\n        }\n        //     Checking if number if dashes after every R are >= than that in target\n        count1=0;count2=0;\n        for(int i=start.size()-1;i>=0;i--)\n        {\n            if(start[i]==\'_\')count1++;\n            if(start[i]==\'R\')afterDashesStart.push_back(count1); \n            \n            if(target[i]==\'_\')count2++;\n            if(target[i]==\'R\')afterDashesTarget.push_back(count2); \n        }\n        \n        for(int i=0;i<afterDashesTarget.size();i++)\n        {\n            if(afterDashesStart[i]<afterDashesTarget[i])return false;\n        }\n        \n        return true;        \n    }\n};\n```
['C']