当前位置:网站首页>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;
}
边栏推荐
- Jianmu continuous integration platform v2.2.2 release
- flask-sqlalchemy 循环引用
- Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
- The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
- CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions
- Industrial computer anti-virus
- Docker install MySQL
- [Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
- Take you to master the formatter of visual studio code
- [web security] nodejs prototype chain pollution analysis
猜你喜欢

Vulhub vulnerability recurrence 77_ zabbix

A new understanding of how to encrypt industrial computers: host reinforcement application

Go learning notes - constants

The most effective futures trend strategy: futures reverse merchandising

Zephyr 学习笔记1,threads

Used on windows Bat file startup project

Xcode 14之大变化详细介绍

Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
![[kubernetes series] kubesphere is installed on kubernetes](/img/2b/eb39cf78b3bb9908b01f279e2f9958.png)
[kubernetes series] kubesphere is installed on kubernetes
![[Valentine's day] - you can change your love and write down your lover's name](/img/ab/402872ad39f9dc58fd27dd6fc823ef.jpg)
[Valentine's day] - you can change your love and write down your lover's name
随机推荐
The number of patent applications in China has again surpassed that of the United States and Japan, ranking first in the world for 11 consecutive years
One of the general document service practice series
[kubernetes series] kubesphere is installed on kubernetes
Chain ide -- the infrastructure of the metauniverse
The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
I was pressed for the draft, so let's talk about how long links can be as efficient as short links in the development of mobile terminals
Boast about Devops
Zephyr 學習筆記2,Scheduling
Jianmu continuous integration platform v2.2.2 release
Review of enterprise security incidents: how can enterprises do a good job in preventing source code leakage?
Comparison between applet framework and platform compilation
输入年份、月份,确定天数
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
Rhcsa the next day
Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
[real case] how to deal with the failure of message consumption?
Zephyr 学习笔记1,threads
Advanced MySQL: Basics (5-8 Lectures)
Why does the producer / consumer mode wait () use while instead of if (clear and understandable)
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and