Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
87005 sh25_zhoumy 字符串p型编码 C++ 通过 0 MS 252 KB 619 2026-04-10 15:05:32

Tests(1/1):


#include <iostream> #include <string> using namespace std; int main() { string str; cin >> str; if (str.empty()) { cout << "" << endl; return 0; } string res; char current = str[0]; int count = 1; for (int i = 1; i < str.size(); i++) { if (str[i] == current) { count++; } else { res += to_string(count); res += current; current = str[i]; count = 1; } } res += to_string(count); res += current; cout << res << endl; return 0; }


测评信息: