西安电子大学计算机考研复试机试(2019)+ 牛客网(划分字串+map应用)

2019-04-13 15:52发布

#include #include #include using namespace std; int main() { string str; while (cin >> str) { map mp; for (int i = 0; i < str.length(); i++) { for (int len = 1; len <= str.length() - i; len++) { string tmp = str.substr(i, len); cout<<"tmp:"<::iterator it; for (it = mp.begin(); it != mp.end(); it++) { if (it->second > 1) cout << it->first << " " << it->second << endl; } } return 0; }
  https://www.nowcoder.com/practice/bcad754c91a54994be31a239996e7c11?tpId=40&tqId=21399&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking