anon20016

F

Nov 1st, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main() {
  10. string s;
  11. cin >> s;
  12. map<string, int> m;
  13. for (int i = 0; i < s.size(); i++) {
  14. for (int j = i; j < s.size(); j++) {
  15. m[s.substr(i, j - i + 1)]++;
  16. }
  17. }
  18. cout << m.size() << endl;
  19. for (auto i : m) {
  20. cout << i.first << ' ' << i.second << endl;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment