hiho week 84 register

Ended

Participants:186

Verdict:Accepted
Score:100 / 100
Submitted:2016-02-13 12:30:04

Lang:G++

Edit
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
#include <iostream>
#include <string>
#include <unordered_set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    unordered_set<int> fNums = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };
    unordered_set<string> res;
    string iStr = "";
    cin >> iStr;
    for (int i = 0; i < iStr.length(); i++) {
        unordered_set<char> tmpSet;
        for (int j = i; j < iStr.length(); j++) {
            tmpSet.insert(iStr[j]);
            if (fNums.find(tmpSet.size()) != fNums.end())
                res.insert(iStr.substr(i, j - i + 1));
        }
    }
    vector<string> outVec(res.begin(), res.end());
    sort(outVec.begin(), outVec.end());
    for (auto s : outVec) cout << s << endl;
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX