当前位置:网站首页>L1-023 output gplt (20 points)
L1-023 output gplt (20 points)
2022-07-04 07:29:00 【Inter personal liabilities^】
L1-023 Output GPLT (20 branch )
A given length does not exceed 10000 Of 、 A string consisting only of English letters . Please reorder the characters , Press GPLTGPLT....
Output in this order , And ignore the other characters . Of course , Four types of characters ( Case insensitive ) It doesn't have to be the same number , If a character has been printed out , Then press the remaining characters GPLT
Sequential printing , Until all characters are printed .
Input format :
The input is given in a line with a length not exceeding 10000 Of 、 A non - empty string consisting only of English letters .
Output format :
Output the sorted string on a line by the title . The question guarantees that the output is not empty .
sample input :
pcTclnGloRgLrtLhgljkLhGFauPewSKgt
sample output :
GPLTGPLTGLTGLGLL
First, convert all the characters in the string into uppercase letters , Then count the number of corresponding letters , Just keep outputting
tolower() The function converts all strings into lowercase letters
toupper() The function converts all strings into uppercase letters
AC Code
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
typedef long long ll;
const int N=100010;
int main()
{
int G = 0, P = 0, L = 0, T = 0;
string a;
cin >> a;
int len = a.size();
for(int i = 0; i < len; i ++ )
{
if(toupper(a[i]) == 'G') G ++ ;
else if(toupper(a[i]) == 'P') P ++ ;
else if(toupper(a[i]) == 'L') L ++ ;
else if(toupper(a[i]) == 'T') T ++ ;
}
while(G || P || L || T)
{
if(G)
{
cout << 'G';
G -- ;
}
if(P)
{
cout << 'P';
P -- ;
}
if(L)
{
cout << 'L';
L -- ;
}
if(T)
{
cout << 'T';
T -- ;
}
}
return 0;
}
边栏推荐
- NLP-文献阅读总结
- 用于压缩视频感知增强的多目标网络自适应时空融合
- Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
- tornado之目录
- Flink memory model, network buffer, memory tuning, troubleshooting
- Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
- leetcode825. Age appropriate friends
- MySQL中的文本處理函數整理,收藏速查
- Deep profile data leakage prevention scheme
- The IP bound to the socket is inaddr_ The meaning of any htonl (inaddr_any) (0.0.0.0 all addresses, uncertain addresses, arbitrary addresses)
猜你喜欢
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
Tri des fonctions de traitement de texte dans MySQL, recherche rapide préférée
Take you to master the formatter of visual studio code
NLP-文献阅读总结
【Kubernetes系列】Kubernetes 上安装 KubeSphere
Data double write consistency between redis and MySQL
Oceanbase is the leader in the magic quadrant of China's database in 2021
Node connection MySQL access denied for user 'root' @ 'localhost' (using password: yes
Zephyr 学习笔记1,threads
随机推荐
User login function: simple but difficult
【森城市】GIS数据漫谈(一)
Solution of running crash caused by node error
2022-021ARTS:下半年開始
Handwritten easy version flexible JS and source code analysis
Vulhub vulnerability recurrence 76_ XXL-JOB
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Transition technology from IPv4 to IPv6
Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
Status of the thread
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
"Sword finger offer" 2nd Edition - force button brush question
The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
Set JTAG fuc invalid to normal IO port
The IP bound to the socket is inaddr_ The meaning of any htonl (inaddr_any) (0.0.0.0 all addresses, uncertain addresses, arbitrary addresses)
Routing decorator of tornado project
MySQL中的文本处理函数整理,收藏速查
Label management of kubernetes cluster
NLP literature reading summary
rapidjson读写json文件