#45450: cpp answer


1121226@stu.wghs.tp.edu.tw (Arthur✨EC✨小蜜楓)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.139]
最後登入時間 :
2025-05-14 12:52:05
a782. 4. Redundant Acronym Syndrome Syndrome -- HP CodeWars2008 | From: [60.248.154.143] | 發表日期 : 2025-03-05 15:48

//太酷啦
#include <bits/stdc++.h>
using namespace std; int main(){ string line; while (getline(cin, line)&&line!="END"){ // 分行輸入直到輸入=="END"為止 stringstream ss(line); // 將每行的字串轉換成字串流 string word,acronym; while (ss>>word){ // 將每個單字轉換成字串 acronym+=toupper(word[0]); // 將第一個字母轉成大寫 } cout<<acronym<<" "<<word<<endl; // 輸出結果 } return 0; }
 
ZeroJudge Forum