標題:
602 字串拆解
[打印本頁]
作者:
李知易
時間:
2024-12-20 22:58
標題:
602 字串拆解
1. 題目說明:
請依下列題意進行作答,使輸出值符合題意要求。
2. 設計說明:
請撰寫一程式,讓使用者輸入一個包含英文大小寫的字串,並依序將字串中的大、小寫字母分離,最後依序輸出字串中的大寫字串、小寫字串及大寫字母的數量。
提示:若使用 Java 語言答題,請以「JP」開頭命名包含 main 靜態方法的 class,評測系統才能正確評分。
3. 輸入輸出:
輸入說明
一個包含英文大小寫的字串
輸出說明
字串中的大寫字串、小寫字串及大寫字母的數量
範例輸入
ComPuTer
範例輸出
CPT
omuer
3
本帖隱藏的內容需要回復才可以瀏覽
作者:
李穎俊
時間:
2024-12-21 14:33
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main(){
getline(cin,str);
for(char c:str){
if(c>='A' && c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl<<s2<<endl;
cout<<s1.length();
return 0;
}
複製代碼
作者:
張淯祺
時間:
2024-12-21 14:34
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main()
{
getline(cin,str);
for(char c:str)
{
if(c>='A'&&c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl;
cout<<s2<<endl;
cout<<s1.length()<<endl;
return 0;
}
複製代碼
作者:
洪榮辰
時間:
2024-12-21 14:34
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str, s1, s2;
getline(cin, str);
for(char c : str)
{
if(c>='A' && c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl;
cout<<s2<<endl;
cout<<s1.length()<<endl;
}
複製代碼
作者:
蔡岑昕
時間:
2024-12-21 14:35
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main()
{
getline(cin,str);
for(char c:str)
{
if(c>='A' && c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl;
cout<<s2<<endl;
cout<<s1.length()<<endl;
return 0;
}
複製代碼
作者:
劉秉昕
時間:
2024-12-21 14:35
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main()
{
getline(cin,str);
for(char c:str)
{
if(c>='A' && c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl;
cout<<s2<<endl;
cout<<s1.length()<<endl;
return 0;
}
複製代碼
作者:
張仲言
時間:
2024-12-27 21:31
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main()
{
getline(cin,str);
for(char c:str)
{
if(c>='A' and c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<'\n'<<s2<<'\n'<<s1.length()<<'\n';
return 0;
}
複製代碼
作者:
朱奕祈
時間:
2024-12-28 10:52
#include<bits/stdc++.h>
using namespace std;
string str,s1,s2;
int main(){
getline(cin,str);
for(char c:str){
if(c>='A' && c<='Z')
s1+=c;
else
s2+=c;
}
cout<<s1<<endl<<s2<<endl;
cout<<s1.length();
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2