Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar14 / src.cpp
blob: ff176fdc45634a9d7e65d36826f0ddadb0495441 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
#include<unordered_map>

int main() {
    std::string example = "abcbabc";
    std::unordered_map<char, int> mp;
    int cnt = 1;

    for(char c : example) {
        if(mp[c] > 0) {
            ++cnt;
            mp.clear();
        }
        mp[c]++;
    }

    std::cout << cnt;
}