zoukankan      html  css  js  c++  java
  • 反片语 (Ananagrams,UVa 156)

    题目描述:

     1 #include <iostream>
     2 #include <string>
     3 #include <cctype>
     4 #include <vector>
     5 #include <map>
     6 #include <algorithm>
     7 using namespace std;
     8 
     9 map<string,int> msi ;
    10 vector<string> words ;
    11 string re(string &s){
    12     string a = s ;
    13     for(int i=0;i<a.length();i++)
    14         a[i] = tolower(a[i]) ;
    15     sort(a.begin(),a.end())    ;
    16     return a ;
    17 }
    18 int main(int argc, char *argv[])
    19 {
    20     string s ;
    21     while(cin >> s){
    22         if(s[0] == '#') break ;
    23         words.push_back(s) ;
    24         string r= re(s) ;
    25         if(!msi.count(r))    msi[r] = 0 ;
    26         msi[r] ++ ; 
    27     }
    28     vector<string> a ;
    29     for(int i=0;i<words.size();i++)
    30         if(msi[re(words[i])] == 1) a.push_back(words[i]) ;
    31         sort(a.begin(),a.end()) ;
    32         for(int i=0;i<a.size() ;i++) cout << a[i] <<"
    " ;
    33     return 0;
    34 }
  • 相关阅读:
    CSS选择器
    CSS样式与语法
    实训第二天
    初学前端
    html-路径和图像标签
    html
    JavaScript(基础)
    CSS(2)
    CSS()
    HTML(链接与表单)
  • 原文地址:https://www.cnblogs.com/secoding/p/9490664.html
Copyright © 2011-2022 走看看