我是靠谱客的博主 无情眼神,这篇文章主要介绍反片语 (Ananagrams,UVa 156)题目描述:,现在分享给大家,希望可以做个参考。

题目描述:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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] <<"n" ; 33 return 0; 34 }

 

转载于:https://www.cnblogs.com/secoding/p/9490664.html

最后

以上就是无情眼神最近收集整理的关于反片语 (Ananagrams,UVa 156)题目描述:的全部内容,更多相关反片语内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(88)

评论列表共有 0 条评论

立即
投稿
返回
顶部