# MKOI R5 A Princess! Ready for running!!## 题目背景$textPrincess$ 因为天天喜欢 $textrun$所以数学没学好。## 题目描述我们定义: 若 $S$ 是一个仅由 $0$ 到 $9$ 间的数字组成的字符串我们便称它满足性质 $P$; 若 $S$ 满足性质 $P$且 $S$ 是 $S$ 的一个子串我们便称 $S$ 对于 $S$ 满足性质
#include <iostream>
#include <string>
using namespace std;
int main() {
string R;
cin >> R;
int max_length = 0;
int current_length = 0;
for (int i = 0; i < R.length(); i++) {
if (isdigit(R[i])) {
current_length++;
} else {
current_length = 0;
}
max_length = max(max_length, current_length);
}
cout << max_length << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/ifO9 著作权归作者所有。请勿转载和采集!