diff --git "a/2224020152/\347\254\254\345\233\233\345\215\225\345\205\203/\346\261\202\344\270\200\344\270\252\344\270\262\344\270\255\345\207\272\347\216\260\347\232\204\347\254\254\344\270\200\344\270\252\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\344\270\262.cpp" "b/2224020152/\347\254\254\345\233\233\345\215\225\345\205\203/\346\261\202\344\270\200\344\270\252\344\270\262\344\270\255\345\207\272\347\216\260\347\232\204\347\254\254\344\270\200\344\270\252\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\344\270\262.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..78d4d39e7f70632324d41efef4dcf0e3bbd1347b --- /dev/null +++ "b/2224020152/\347\254\254\345\233\233\345\215\225\345\205\203/\346\261\202\344\270\200\344\270\252\344\270\262\344\270\255\345\207\272\347\216\260\347\232\204\347\254\254\344\270\200\344\270\252\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\344\270\262.cpp" @@ -0,0 +1,23 @@ +void MaxStr(char* Str, int& i, int& j) +{ + int idx, max = 1; + char c = Str[0]; + i = 0; j = 1; + for (idx = 1; Str[idx] != '\0'; idx++) { + if (c == Str[idx]) + max++; + else if (max > j) { + i = idx - max; + j = max; + max = 1; + } + else { + max = 1; + } + c = Str[idx]; + } + if (max > j) { + i = idx - max; + j = max; + } +}