easy to understand , read each line will impact your answer.
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

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

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

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

# Code
```cpp []
struct Comp {
    bool operator()(const vector<string> &a, const vector<string> &b) {
        int numA = stoi(a[1]);
        int numB = stoi(b[1]);
        if(numA==numB){
          return a[0]>b[0];
        }
        return numA < numB;  // Convert string to int and compare
    }
};
class Solution {
public:
    int checkOffline(unordered_map<string,int>offline,int time,int i){
        string t = "id" + std::to_string(i);
        if(offline.find(t)==offline.end()) return 1;
        else if(offline.find(t)!=offline.end() && offline[t]<=time) return 1;
        return 0;
    }
    vector<int> countMentions(int numberOfUsers, vector<vector<string>>& events) {
        vector<unordered_map<string,int>>messages;
        sort(events.begin(), events.end(), Comp());
        for(auto it:events){
            cout<<it[0]<<" "<<it[1]<<" "<<it[2]<<endl;
        }
        for(auto &it:events){
                if(it[0]=="MESSAGE"){
                    unordered_map<string,int>temp;    
                    stringstream ss(it[2]);
                    string user;
                    while(getline(ss,user,' ')){
                      if(user!="HERE" || user!="ALL"){
                          temp[user]+=1;
                      }
                    }
                    messages.push_back(temp);
                }
            }
        vector<int>ans;
        for(int i=0;i<numberOfUsers;i++){
            unordered_map<string,int>offline;
            int mes_ind=0;
            int count=0;
            for(auto &it:events){
                if(it[0]=="MESSAGE"){
                    if(it[2]=="ALL") count+=1;
                    else if(it[2]=="HERE") count+=checkOffline(offline,stoi(it[1]),i);
                    else {
                        string t = "id" + std::to_string(i);
                        if(messages[mes_ind].find(t)!=messages[mes_ind].end()){
                              count+=messages[mes_ind][t];
                         }
                    }
                    mes_ind++;    
                }
                else{
                    stringstream ss(it[2]);
                    string user;
                    while(getline(ss,user,' ')){
                        user = "id"+user;
                        offline[user] = stoi(it[1])+60; 
                    }
                }
            }
            ans.push_back(count);
        }
        return ans;
    }
};
```
['C++']