Advertisement
adwas33

Untitled

Sep 29th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <utility>
  6. using namespace std;
  7. //string dekompresja(string &a,int itterator)
  8. //{
  9. // int pomociter=itterator;
  10. // string pomoc=a;
  11. // string pomoc2;
  12. // while(pomociter+1<pomoc.length())
  13. //{
  14.  
  15. // }
  16.  
  17. // return a;
  18. //}
  19. //string wycinka(string &a,int itterator)
  20. //{
  21. // string pomoc;
  22. // while(a[itterator]!=']')
  23. //{
  24.  
  25. // cout<<"pomoc;";
  26. // pomoc+=a[itterator];
  27. //itterator++;
  28. // }
  29. // pomoc=']';
  30. // return pomoc;
  31. //}
  32. int main()
  33. {
  34. int i;
  35. string a;
  36. string poprawka;
  37. string b;
  38.  
  39. int segmenty=0 ;
  40. cin>>a;
  41. while(i<a.length())
  42. {
  43. // cout<<"glowska";
  44. if(a[i]=='[')
  45. {
  46. segmenty++;
  47. }
  48. i++;
  49. }
  50. i=0;
  51. vector< pair<int,int>> powtorzenia(segmenty);
  52. int ittp=0;
  53. int ittl=0;
  54. while(i<a.length())
  55. {
  56. // cout<<"glowska";
  57. if(a[i]=='[')
  58. {
  59. powtorzenia[ittp].first=i;
  60. ittp++;
  61. }
  62. if(a[i]==']')
  63. {
  64. powtorzenia[ittl].second=i;
  65. }
  66. i++;
  67. }
  68. cout<<segmenty;
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement