Problem p02385 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <string>
class DICE {
private:
  int Label[6];

public:
  DICE();
  void RotateDirection(std::string);
  void Rotate(int, int, int, int);
  int GetLabel(int x) { return Label[x]; }
  void TopFront(int, int);
  bool CheckConsistentLabel(DICE AnotherDice);
};
DICE::DICE() {
  for (int i = 0; i < 6; ++i) {
    std::cin >> Label[i];
  }
}
void DICE::RotateDirection(std::string s) {
  if (s == "E") {
    Rotate(0, 3, 5, 2);
  }
  if (s == "N") {
    Rotate(0, 1, 5, 4);
  }
  if (s == "S") {
    Rotate(0, 4, 5, 1);
  }
  if (s == "W") {
    Rotate(0, 2, 5, 3);
  }
}

void DICE::Rotate(int a, int b, int c, int d) {
  std::swap(Label[a], Label[b]);
  std::swap(Label[b], Label[c]);
  std::swap(Label[c], Label[d]);
}
void DICE::TopFront(int top, int front) {
  const int size_str = 7;
  std::string str[size_str] = {"N", "N", "N", "W", "N", "N", "N"};
  // std::string str = "NNNNWWWW" ;
  for (unsigned int i = 0; i < size_str; ++i) {
    if (front == Label[1]) {
      break;
    }

    RotateDirection(str[i]);
  }
  while (top != Label[0]) {
    RotateDirection("W");
  }
}
bool DICE::CheckConsistentLabel(DICE AnotherDice) {
  int NumberLabel[101] = {0};
  for (int i = 0; i < 6; ++i) {
    ++NumberLabel[Label[i]];
    --NumberLabel[AnotherDice.GetLabel(i)];
  }
  int i = 0;
  while (i <= 100) {
    if (NumberLabel[i] != 0) {
      return false;
    }
    ++i;
  }
  return true;
}
int main(void) {
  DICE a, b;
  if (!a.CheckConsistentLabel(b)) {
    std::cout << "No\\n";
    // system("pause");
    return 0;
  }
  a.TopFront(b.GetLabel(0), b.GetLabel(1));
  for (int i = 0; i < 6; ++i) {
    if (a.GetLabel(i) != b.GetLabel(i)) {
      std::cout << "No\\n";
      // system("pause");
      return 0;
    }
  }
  std::cout << "Yes\\n";
  // system("pause");
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
class DICE {
private:
  int Label[6];

public:
  DICE();
  void RotateDirection(std::string);
  void Rotate(int, int, int, int);
  int GetLabel(int x) { return Label[x]; }
  void TopFront(int, int);
  bool CheckConsistentLabel(DICE AnotherDice);
};
DICE::DICE() {
  for (int i = 0; i < 6; ++i) {
    std::cin >> Label[i];
  }
}
void DICE::RotateDirection(std::string s) {
  if (s == "E") {
    Rotate(0, 2, 5, 3);
  }
  if (s == "N") {
    Rotate(0, 4, 5, 1);
  }
  if (s == "S") {
    Rotate(0, 1, 5, 4);
  }
  if (s == "W") {
    Rotate(0, 3, 5, 2);
  }
}

void DICE::Rotate(int a, int b, int c, int d) {
  std::swap(Label[d], Label[c]);
  std::swap(Label[c], Label[b]);
  std::swap(Label[b], Label[a]);
}
void DICE::TopFront(int top, int front) {
  std::string str[7] = {"N", "N", "N", "N", "W", "W", "W"};
  for (unsigned int i = 0; i < 7; ++i) {
    if (front == Label[1]) {
      break;
    }
    RotateDirection(str[i]);
  }
  while (top != Label[0]) {
    RotateDirection("W");
  }
}
bool DICE::CheckConsistentLabel(DICE AnotherDice) {
  int NumberLabel[101] = {0};
  for (int i = 0; i < 6; ++i) {
    ++NumberLabel[Label[i]];
    --NumberLabel[AnotherDice.GetLabel(i)];
  }
  int i = 0;
  while (i <= 100) {
    if (NumberLabel[i] != 0) {
      return false;
    }
    ++i;
  }
  return true;
}
int main(void) {
  DICE a, b;
  if (!a.CheckConsistentLabel(b)) {
    std::cout << "No\\n";
    // system("pause");
    return 0;
  }
  a.TopFront(b.GetLabel(0), b.GetLabel(1));
  for (int i = 0; i < 6; ++i) {
    if (a.GetLabel(i) != b.GetLabel(i)) {
      std::cout << "No\\n";
      // system("pause");
      return 0;
    }
  }
  std::cout << "Yes\\n";
  // system("pause");
  return 0;
}