Huawei社OJ:文字列処理

1の#include <iostreamの>
 2の#include <STDLIB.H>
 3の#include < ストリング >
 4の#include <sstream提供>
 5の#include <ベクトル>
 6  使って 名前空間STD。
7  
8  のint main()の
 9  {
 10      ストリングS。
11      のgetline(CIN、S)。
12      のためには、(自動それはs.beginを()=;!それ= s.endを();それ++ 13      {
 14          であれば(!はisalpha(* IT))
 15              (※)= '  ' ;
16     }
 17の 
18      istringstreamのSS(S)。
19      文字列TMP;
20      ベクター< ストリング > ANS。
21      一方(SS >> TMP)
 22      {
 23          TMP [ 0 ] = TOUPPER(TMP [ 0 ])。
24          ans.push_back(TMP)。
25          // tmp.clear()。
26      }
 27      (ans.back())を挿入((ans.back())の端部()、。。' ' );
28 については、(!自動車はそれがans.beginを()=;それ= ans.end();それを++ 29          {
 30          であれば(それ== PREV(ans.end()))
 31              COUT << * こと。
32          他の
33              coutの<< *それ<< '  ' ;
34      }
 35      システム(" 一時停止" )。
36      リターン 0 37 }

 

おすすめ

転載: www.cnblogs.com/zhuruibi/p/11298395.html