Easy C++ Solution in 3 lines only
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem involves determining how many people from a given list are senior citizens,
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem involves determining how many people from a given list are senior citizens, defined as individuals aged over 60. The age information is embedded within a string, and we need to extract and interpret this data. The solution iterates through each string in the list, extracts the age, and counts how many times the age exceeds 60.\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Initialization: \n- Initialize a counter cnt to zero, which will keep track of the number of senior citizens.\n\n2. Iteration:\n\n- Loop through each string s in the details vector.\n- Extract the substring containing the age from s using s.substr(11, 2).\n- This assumes that the age is represented as a two-character substring starting at the 11th position in the string.\n- Convert the extracted substring to an integer using stoi.\n- If the extracted age is greater than 60, increment the counter cnt.\n3. Return: \n- After completing the loop, return the value of cnt, which represents the number of senior citizens.\n# Complexity\n- Time complexity:$$O(n)$$ \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$ \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int countSeniors(vector<string>& details) {\n        int cnt = 0;\n        for (auto s : details) {\n            int age = stoi(s.substr(11, 2));\n            if (age > 60) cnt++;\n        }\n        return cnt;\n    }\n};\n\n```
['C++']