1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <map> #include <string> using namespace std;
map<string, int> mp;
string s;
int main() { int fff = 0; while(getline(cin, s)) { int len = s.length(); if(fff) { cout << mp[s] << endl; continue; } if(s.length() == 0) { fff = 1; continue; } string tmp = ""; for(int i = 0; i < len; i++) { tmp += s[i]; mp[tmp]++; } }
return 0; }
|