Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <utility>
- using namespace std;
- //string dekompresja(string &a,int itterator)
- //{
- // int pomociter=itterator;
- // string pomoc=a;
- // string pomoc2;
- // while(pomociter+1<pomoc.length())
- //{
- // }
- // return a;
- //}
- //string wycinka(string &a,int itterator)
- //{
- // string pomoc;
- // while(a[itterator]!=']')
- //{
- // cout<<"pomoc;";
- // pomoc+=a[itterator];
- //itterator++;
- // }
- // pomoc=']';
- // return pomoc;
- //}
- int main()
- {
- int i;
- string a;
- string poprawka;
- string b;
- int segmenty=0 ;
- cin>>a;
- while(i<a.length())
- {
- // cout<<"glowska";
- if(a[i]=='[')
- {
- segmenty++;
- }
- i++;
- }
- i=0;
- vector< pair<int,int>> powtorzenia(segmenty);
- int ittp=0;
- int ittl=0;
- while(i<a.length())
- {
- // cout<<"glowska";
- if(a[i]=='[')
- {
- powtorzenia[ittp].first=i;
- ittp++;
- }
- if(a[i]==']')
- {
- powtorzenia[ittl].second=i;
- }
- i++;
- }
- cout<<segmenty;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement