-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproblem-list-manage.cpp
More file actions
33 lines (31 loc) · 917 Bytes
/
problem-list-manage.cpp
File metadata and controls
33 lines (31 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
string s;
map<string, int> mp;
int donecnt, doingcnt;
int main() {
freopen("problems.txt", "r", stdin);
while (getline(cin, s)) {
int lft = -1, rgt = -1;
for (int i = 0; i < s.size(); i++)
if (s[i] == '(') {
lft = i;
break;
}
for (int i = s.size() - 1; i >= 0; i--)
if (s[i] == ')') {
rgt = i;
break;
}
if (lft == -1 || rgt == -1) continue;
mp[s.substr(lft + 1, rgt - lft - 1)]++;
if (s.find("done") != string::npos) donecnt++;
if (s.find("doing") != string::npos) doingcnt++;
}
cout << "Categories: " << endl;
for (auto p: mp)
cout << p.first << ": " << p.second << endl;
cout << "Done: " << donecnt << endl;
cout << "Doing: " << doingcnt << endl;
return 0;
}