Problem p02266 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
int main(void) {
  std::string Input;
  std::cin >> Input;
  std::stack<int> PlaceBackSlash;
  std::stack<std::pair<int, int>> Puddle_Place_Quantity;
  for (unsigned int i = 0; i < Input.size(); ++i) {
    if (Input[i] == '\\') {
      PlaceBackSlash.push(i);
    } else if (Input[i] == '/') {
      if (!(PlaceBackSlash.empty())) {
        //???????????????????????\?????´???
        int PlaceFirstBackSlash = PlaceBackSlash.top();
        PlaceBackSlash.pop();
        int Quantity = 0;
        //??????????????\??¨?°´?????????????????????????????\??\???????°´???????¶??????????
        while (!(Puddle_Place_Quantity.empty()) &&
               Puddle_Place_Quantity.top().first > PlaceFirstBackSlash) {
          Quantity += Puddle_Place_Quantity.top().second;
          Puddle_Place_Quantity.pop();
        }
        //?????????????????????????????????????????\??\???????°´??????????????????
        Puddle_Place_Quantity.push(std::pair<int, int>(
            PlaceFirstBackSlash, i - PlaceFirstBackSlash + Quantity));
      }
    }
  }
  int TotalQuantity = 0;
  std::vector<int> Puddle_Quantity(Puddle_Place_Quantity.size());
  for (unsigned int i = 0; i < Puddle_Quantity.size(); ++i) {
    Puddle_Quantity[i] = Puddle_Place_Quantity.top().second;
    Puddle_Place_Quantity.pop();
    TotalQuantity += Puddle_Quantity[i];
  }
  std::cout << TotalQuantity << std::endl;
  std::cout << Puddle_Quantity.size();
  for (unsigned int i = Puddle_Quantity.size() - 1; i >= 0; --i) {
    std::cout << " " << Puddle_Quantity[i];
  }
  std::cout << std::endl;
  //	system("pause");
  return 0;
}

Fixed submission:
#include <iostream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
int main(void) {
  std::string Input;
  std::cin >> Input;
  std::stack<int> PlaceBackSlash;
  std::stack<std::pair<int, int>> Puddle_Place_Quantity;
  for (unsigned int i = 0; i < Input.size(); ++i) {
    if (Input[i] == '\\') {
      PlaceBackSlash.push(i);
    } else if (Input[i] == '/') {
      if (!(PlaceBackSlash.empty())) {
        //???????????????????????\?????´???
        int PlaceFirstBackSlash = PlaceBackSlash.top();
        PlaceBackSlash.pop();
        int Quantity = 0;
        //??????????????\??¨?°´?????????????????????????????\??\???????°´???????¶??????????
        while (!(Puddle_Place_Quantity.empty()) &&
               Puddle_Place_Quantity.top().first > PlaceFirstBackSlash) {
          Quantity += Puddle_Place_Quantity.top().second;
          Puddle_Place_Quantity.pop();
        }
        //?????????????????????????????????????????\??\???????°´??????????????????
        Puddle_Place_Quantity.push(std::pair<int, int>(
            PlaceFirstBackSlash, i - PlaceFirstBackSlash + Quantity));
      }
    }
  }
  int TotalQuantity = 0;
  std::vector<int> Puddle_Quantity(Puddle_Place_Quantity.size());
  for (unsigned int i = 0; i < Puddle_Quantity.size(); ++i) {
    Puddle_Quantity[i] = Puddle_Place_Quantity.top().second;
    Puddle_Place_Quantity.pop();
    TotalQuantity += Puddle_Quantity[i];
  }
  std::cout << TotalQuantity << std::endl;
  std::cout << Puddle_Quantity.size();
  for (int i = Puddle_Quantity.size() - 1; i >= 0; --i) {
    std::cout << " " << Puddle_Quantity[i];
  }
  std::cout << std::endl;
  //	system("pause");
  return 0;
}