Java solution 
ApproachtS - contains the timeStamp at which the corresponding element in oflnS can be removed.oflnS - contains all the ids that are offline at a given timeStam
# Approach
tS - contains the timeStamp at which the corresponding element in oflnS can be removed.

oflnS - contains all the ids that are offline at a given timeStamp.

mentions - to update the number of mentions of each user.


->  so first we sort all the elements in events according to timeStamp if both events have same timestamp then we pick the one which has OFFLINE  first.

-> At each timeStamp we check in tS if any element in tS has reached its limit of +60 then we remove them from tS and oflnS meaning that we are making that user online after 60 seconds cycle.

-> if it has ALL then we simply increment mentions of all the ids by 1.

-> if it has HERE then we increment all the ids which are online that means we exclude elements that are in oflnS.

-> it it has OFFLINE then we add the timeStamp+60 to the tS list and its corresponding user into oflnS.



# Code
```java []
class Solution {
    public int[] countMentions(int numberOfUsers, List<List<String>> events) {
        ArrayList<Integer> tS = new ArrayList<Integer>();
        ArrayList<Integer> oflnS = new ArrayList<Integer>();

        int mentions[] = new int[numberOfUsers];
        Arrays.fill(mentions, 0);

        events.sort((event1, event2) -> {
            int timeComparison = Integer.parseInt(event1.get(1)) - Integer.parseInt(event2.get(1));
            if (timeComparison == 0) {
                return event1.get(0).equals("OFFLINE") ? -1 : 1;
            }
            return timeComparison;
        });


        for (int i = 0; i < events.size(); i++) {
            int timeS = Integer.parseInt(((events.get(i)).get(1)));

            for (int index = 0; index < tS.size(); index++) {
                if (tS.get(index) <= timeS) {
                    tS.remove(index);
                    oflnS.remove(index);
                    index--;
                }
            }

            if ((events.get(i)).get(0).equals("MESSAGE")) {
                if ((events.get(i)).get(2).equals("ALL")) {
                    mentions = Arrays.stream(mentions).map(x -> x + 1).toArray();
                } else if ((events.get(i)).get(2).equals("HERE")) {
                    Set<Integer> skipIndices = oflnS.stream().collect(Collectors.toSet());

                    for (int m = 0; m < mentions.length; m++) {
                        if (!skipIndices.contains(m)) {
                            mentions[m] = mentions[m] + 1;
                        }
                    }

                } else {
                    String idsString = events.get(i).get(2);
                    String[] ids = idsString.split(" ");

                    for (String idString : ids) {
                        String numericPart = idString.replaceAll("\\D", "");

                        if (!numericPart.isEmpty()) {
                            int id = Integer.parseInt(numericPart);
                            mentions[id]++;
                        }
                    }
                }
            } else {
                String idString = ((events.get(i)).get(2));
                String numericPart = idString.replaceAll("\\D", "");
                int id = Integer.parseInt(numericPart);
                int t = Integer.parseInt(((events.get(i)).get(1)));
                oflnS.add(id);
                tS.add(t + 60);
            }
        }

        return mentions;
    }
}

```
['Java']