-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.cpp
42 lines (36 loc) · 855 Bytes
/
main.cpp
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
34
35
36
37
38
39
40
41
42
// Author : Qi Zhang
// Date : 2018-12-11
#include <bits/stdc++.h>
using namespace std;
vector<string> mysplit(string &s, char t){
vector<string> info;
string cur;
for(auto c: s){
if(c == t){
if(cur != "") info.push_back(cur);
cur = "";
}
else cur += c;
}
if(cur != "") info.push_back(cur);
return info;
}
int main()
{
string line;
while (getline(cin, line)) {
vector<string> lines = mysplit(line, ';');
unordered_map<string, int> mp;
int x, y;
for(int i = 0; i < lines.size(); i++){
if(mp.find(lines[i]) != mp.end()) {
x = mp[lines[i]];
y = i+1;
break;
}
else mp[lines[i]] = i+1;
}
cout << x << "," << y << endl;
}
return 0;
}