Use of the ultraviolet A 156 map

Source: Internet
Author: User

Use of the ultraviolet A 156 map

Background: learn knowledge about map. For details, refer to the code.

My code:

# Include
 
  
# Include
  
   
# Include
   
    
# Include
    Using namespace std; map
     
      
Map1; map
      
        Map2; vector
       
         Vector1, ans; string string+lower (string string1) {for (int I = 0; I <string1.size (); I ++) string1 [I] = tolower (string1 [I]); sort (string1.begin (), string1.end (); // because string defines four arithmetic operations and Relational operators, return string1;} int main (void) {string string1, string2; while (cin> string1 & string1! = "#") {Vector1.push _ back (string1); string1 = string1_lower (string1); if (map1.count (string1) = 0) map1 [string1] = 0; // use map first. count () to check whether the key exists. Map1 [string1] ++; // directly use the key as the subscript to access the second element} for (int I = 0; I <vector1.size (); I ++) {if (map1 [string1_lower (vector1 [I])] = 1) ans. push_back (vector1 [I]);} sort (ans. begin (), ans. end (); for (vector
        
          : Iterator it = ans. begin (); it! = Ans. end (); it ++) cout <* it <
         
          

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.