//土尔逊Torson 编写于2023/06/13 #include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { string str; while (cin >> str) { map<string, int> number; for (int i = 0; i <= str.size(); ++i) { for (int j = 0; j < i; ++j) { string key = str.substr(j, i - j); //每个子串 number[key]++; //映射值加1 } } map<string, int>::iterator it; //定义迭代器 for (it = number.begin(); it != number.end(); ++it) { if (1 < it->second) { cout << it->first << " " << it->second << endl; } } } system("pause"); return EXIT_SUCCESS; } // 64 位输出请用 printf("%lld")