📄 dic.prog
字号:
Using a dictionary to count the number of occurrences of the elements in a sequence of strings, terminated by string ``stop''.\smallskip\#include \<LEDA/dictionary.h\>\smallskipmain()\\$\{$\hspace*{.5cm} dictionary\<string,int\> $D$;\smallskip\hspace*{.5cm} string $s$;\\\hspace*{.5cm} dic\_item $it$;\smallskip\hspace*{.5cm} {\bf while} (cin \>\> $s$)\hspace*{1.5cm} $\{$\ $it = D$.lookup($s$);\\\hspace*{1.85cm} if ($it==nil$) $D$.insert($s,1$);\\\hspace*{1.85cm} else $D$.change\_inf($it$,$D$.inf($it$)+1);\\\hspace*{1.5cm} $\}$\smallskip\hspace*{.5cm} {\bf forall\_items}($it,D$) cout \<\< $D$.key($it$) \<\< `` : " \<\< $D$.inf($it$) \<\< endl;\\\smallskip$\}$\\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -