Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <map>
- using namespace std;
- int main()
- {
- string k;
- cin>>k;
- int len=k.size();
- map<char, int>mapa;
- int current_len=0;
- int max_len=0;
- int j = 0;
- int i =0 ;
- while(j < len) {
- if(mapa[k[j]] == 0){
- mapa[k[j]]++;
- current_len++;
- max_len=max(max_len, current_len);
- j++;
- }
- else{
- mapa[k[i]]--;
- current_len--;
- i++;
- }
- }
- cout<<max_len;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement