100% ACCEPTANCE | USING QUEUES 🏆🚀😻😻😻
IntuitionIN THIS PROBLEM WE WILL DONT REALLY HAVE TO SHIFT THE VALUES WE JUST NEED TO MAKE A CHECK ON THEM.
WE WILL BE MAINTAINING 2 QUEUES EACH FOR THE TWO WOR
# Intuition
IN THIS PROBLEM WE WILL DONT REALLY HAVE TO SHIFT THE VALUES WE JUST NEED TO MAKE A CHECK ON THEM.
WE WILL BE MAINTAINING 2 QUEUES EACH FOR THE TWO WORDS AND THEN SKIP THE CHARACTER IF IT IS AN 'X' AND KEEP ONLY THE L OR R COUNTER PIECE, AND THEN WE WILL CHECK IF THE NUMBER OF COUNTERPIECES ARE EQUAL OR NOT.
NOW WE WILL CHECK.
IF WE HAVE DISSIMILAR CHARACTERS RETURN FALSE ELSE WE WILL COMPARE IF THE TARGET HAS OCCURANCE OF L BEFORE THE TARGET OR R AFTER THE TARGET THEN RETURN FALSE.
<!-- Describe your first thoughts on how to solve this problem. -->

<!-- # Approach -->
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:O(2N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(2N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    bool canTransform(string start, string result) {
        queue<pair<char,int>> startq,resultq;
        if(start.size()!=result.size()) return false;
        for(int i=0;i<start.size();i++){
            if(start[i]!='X') startq.push({start[i],i});
            if(result[i]!='X') resultq.push({result[i],i});
        }
        if(startq.size()!=resultq.size()) return false;
        while(!startq.empty()){
            auto [startval,startindex]=startq.front();
            startq.pop();
            auto [resultval,resultindex]=resultq.front();
            resultq.pop();
            if(resultval!=startval) return false;
            if(resultval=='L' && startindex<resultindex) return false;
            if(resultval=='R' && startindex>resultindex) return false;
        }
        return true;
        
    }
};
```
['C++']