记录编号 283717 评测结果 AAAAAAAAAA
题目名称 [暑假培训2012] 单词缩写 最终得分 100
用户昵称 Gravatar@@@ 是否通过 通过
代码语言 C++ 运行时间 0.006 s
提交时间 2016-07-15 11:14:01 内存使用 0.32 MiB
显示代码纯文本
  1. #include <fstream>
  2. #include <string>
  3. #include <cstdio>
  4. using namespace std;
  5. ifstream cin("abbreviation.in");
  6. ofstream cout("abbreviation.out");
  7. int n,wl;
  8. string word;
  9. char test;
  10. int main()
  11. {
  12. int i;
  13. cin>>n;
  14. while(cin>>word)
  15. {
  16. wl=word.length();
  17. test=cin.get();
  18. for(i = 0; i < wl; i++)
  19. word[i] = toupper(word[i]);
  20. if(wl<3||word=="THE"||word=="AND"||word=="FOR")
  21. {
  22. if(test=='\n')
  23. cout<<endl;
  24. continue;
  25. }
  26. cout<<word[0];
  27. if(test=='\n') cout<<endl;
  28. }
  29. cin.close();
  30. cout.close();
  31. return 0;
  32. }