Ah ah Ah! Remember, it should be better to read it a few times.
1#include <cstdio>2#include <iostream>3#include <string>4#include <cctype>//1.The test character ctype.h is the header file in the C standard function library, and defines a batch of C-language character classification functions (c character classification functions) to test whether a character belongs to a particular character category, such as alphabetic characters, control characters, and so on. Both single-byte characters and wide characters are supported. 5#include <VECTOR>//2. Indefinite long array size (); Push_back ();p ush_back ();6#include <MAP>//3. Mapping Good Understanding7#include <algorithm>8 using namespacestd;9 Tenmap<string,int>cnt;//! Onevector<string>words; A - stringRepr (Const string&s) - { the stringans=s; - for(intI=0; I<ans.length (); i++) -Ans[i]=tolower (Ans[i]);//4.Cctype converted to lowercase letters - sort (Ans.begin (), Ans.end ()); + returnans; - } + A intMain () at { - intn=0; - strings; - while(cin>>s) - { - if(s[0]=='#') Break; in Words.push_back (s); - stringR=repr (s); to if(!cnt.count (R))//
The //algorithm header file defines a function of Count , which functions like find. This function uses a pair of iterators and a value to make a parameter that returns the statistical result of the number of occurrences of this value.
The writer reads a series of int data, stores them in a vector object, and then counts how many times a given value occurs .
cnt[r]=0;//map!~ +cnt[r]++; - } thevector<string>ans; * for(intI=0; I<words.size (); i++) $ if(Cnt[repr (words[i])]==1) Ans.push_back (Words[i]);Panax Notoginseng sort (Ans.begin (), Ans.end ()); - for(intI=0; I<ans.size (); i++) thecout<<ans[i]<<Endl; + return 0; A}
I just have to know the map.
STL map vector (indefinite length array)