# include <stdio.h> # include <algorithm> # include <string.h> # include <map> # include <iostream> using namespace std; int main() { char a; string x; map<string,int>q; while(true) { scanf("%c",&a); if(a=='\n') { scanf("%c",&a); x="";//一个结束x初始化 } if(a=='\n')//连续两个\n结束了母串的输入 break; x+=a; q[x]+=1; } while(cin>>x) printf("%d\n",q[x]); return 0; }
hdu 1251 统计难题 (map水过),布布扣,bubuko.com
时间: 2024-12-26 20:15:07