Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
78114 sh25_wanghy 字符串p型编码 C++ 通过 0 MS 240 KB 410 2025-12-26 15:23:00

Tests(1/1):


#include <iostream> #include <string> using namespace std; int main() { string str; cin >> str; string encoded; for (int i = 0; i < str.length(); ++i) { int count = 1; while (i + 1 < str.length() && str[i] == str[i + 1]) { ++count; ++i; } encoded += to_string(count) + str[i]; } cout << encoded; return 0; }


测评信息: