文章
1
粉丝
130
获赞
0
访问
2.1k
#include <iostream> #include <string.h> using namespace std; int main(void){ char str[105]; while(cin >> str){ int temp; int* p = new int[300]; for(int i = 0; i < 300; i++) p[i] = -1; int* loc = new int[105]; int* cnt = new int[300]; for(int i = 0; i < 105; i++) loc[i] = -1; for(int i = 0; i < 300; i++) cnt[i] = -1; for (int i = strlen(str) - 1; i >= 0; i--){ cnt[str[i]]++; loc[i] = p[str[i]]; p[str[i]] = i; } for(int i = 0; i < 300; i++) p[i] = 0; for(int i = 0; i < strlen(str); i++){ temp = i; if (p[i] || !cnt[str[i]]) continue; while(temp >= 0){ if (loc[temp] == -1) cout << str[temp] << ":" << temp << endl; else cout << str[temp] << ":" << temp ...
登录后发布评论
暂无评论,来抢沙发