BRUTE FORCE TYPE SOLUTION 
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 []
class Solution {
public:
     vector<int> extractIdentities(const string& identitiesString) {
        vector<int> identities;
        stringstream ss(identitiesString);
        string token;

        while (ss >> token) {
            if (token.substr(0, 2) == "id") {
                identities.push_back(stoi(token.substr(2)));
            }
        }
        return identities;
    }

    vector<int> stringToVector(const string& input) {
        vector<int> result;
        istringstream ss(input);
        int number;
        while (ss >> number) {
            result.push_back(number);
        }
        return result;
    }

    vector<int> countMentions(int n, vector<vector<string>>& events) {
        int sz = events.size();
        vector<int> ans(n, 0);
        
        sort(events.begin(), events.end(), [](const vector<string>& a, const vector<string>& b) {
            if(stoi(a[1]) == stoi(b[1])) return a[0][0] > b[0][0];
            return stoi(a[1]) < stoi(b[1]);
        });

        set<int> useractive;
        for (int i = 0; i < n; i++) {
            useractive.insert(i);
        }

        vector<int> sleep(n, 0);
        vector<int> duration(n, 0);

        for (int i = 0; i < sz; i++) {
            if (events[i][0] == "OFFLINE") {
                vector<int> temp = stringToVector(events[i][2]);
                for (int id : temp) {
                    useractive.erase(id);
                    sleep[id] = 1;
                    duration[id] = stoi(events[i][1]);
                }
            } else {
                for (int j = 0; j < n; j++) {
                    if (sleep[j]) {
                        int curr = stoi(events[i][1]);
                        if (curr - duration[j] >= 60) {
                            useractive.insert(j);
                            sleep[j] = 0;
                        }
                    }
                }

                if (events[i][2] == "ALL") {
                    for (int j = 0; j < n; j++) {
                        ans[j]++;
                    }
                } else if (events[i][2] == "HERE") {
                    for (int id : useractive) {
                        ans[id]++;
                    }
                } else {
                    vector<int> extracted = extractIdentities(events[i][2]);
                    for (int id : extracted) {
                        ans[id]++;
                    }
                }
            }
        }
        return ans;
    }
};


['C++']