Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- using namespace std;
- int main() {
- string s;
- cin >> s;
- map<string, int> m;
- for (int i = 0; i < s.size(); i++) {
- for (int j = i; j < s.size(); j++) {
- m[s.substr(i, j - i + 1)]++;
- }
- }
- cout << m.size() << endl;
- for (auto i : m) {
- cout << i.first << ' ' << i.second << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment