AlexSSH

Untitled

Oct 1st, 2023 (edited)
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. // РАЗМЕСТИТЕ ВАШ КОД ЗДЕСЬ
  5.  
  6. void TestDecoding(const std::string &encode, const std::string &expected) {
  7.     std::string decoded = Decode(encode);
  8.     if (decoded != expected) {
  9.         std::cout << "Test failed: " << expected << " != " << decoded << std::endl;
  10.     } else {
  11.         std::cout << "Test passed: " << expected << " == " << decoded << std::endl;
  12.     }
  13. }
  14.  
  15. int main() {
  16.     TestDecoding("3[b]", "bbb");
  17.     TestDecoding("1[a2[bbb]]", "abbbbbb");
  18.     TestDecoding("3[abc]", "abcabcabc");
  19.     TestDecoding("1[a2[b3[c]]]", "abcccbccc");
  20.     TestDecoding("1[a2[b3[c1[a]]]]", "abcacacabcacaca");
  21.     TestDecoding("1[a2[b3[c1[a2[bb]]]]]", "abcabbbbcabbbbcabbbbbcabbbbcabbbbcabbbb");
  22.     TestDecoding("1[a2[b3[c1[a2[bb3[c]]]]]]",
  23.                  "abcabbcccbbccccabbcccbbccccabbcccbbcccbcabbcccbbccccabbcccbbccccabbcccbbccc");
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment