Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- // РАЗМЕСТИТЕ ВАШ КОД ЗДЕСЬ
- void TestDecoding(const std::string &encode, const std::string &expected) {
- std::string decoded = Decode(encode);
- if (decoded != expected) {
- std::cout << "Test failed: " << expected << " != " << decoded << std::endl;
- } else {
- std::cout << "Test passed: " << expected << " == " << decoded << std::endl;
- }
- }
- int main() {
- TestDecoding("3[b]", "bbb");
- TestDecoding("1[a2[bbb]]", "abbbbbb");
- TestDecoding("3[abc]", "abcabcabc");
- TestDecoding("1[a2[b3[c]]]", "abcccbccc");
- TestDecoding("1[a2[b3[c1[a]]]]", "abcacacabcacaca");
- TestDecoding("1[a2[b3[c1[a2[bb]]]]]", "abcabbbbcabbbbcabbbbbcabbbbcabbbbcabbbb");
- TestDecoding("1[a2[b3[c1[a2[bb3[c]]]]]]",
- "abcabbcccbbccccabbcccbbccccabbcccbbcccbcabbcccbbccccabbcccbbccccabbcccbbccc");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment