当前位置:网站首页>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 literature reading summary
- Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
- Introduction to sap commerce cloud B2B organization function
- Docker install MySQL
- How to share the source code anti disclosure scheme
- Oceanbase is the leader in the magic quadrant of China's database in 2021
- [kubernetes series] kubesphere is installed on kubernetes
- Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
- The idea of implementing charts chart view in all swiftui versions (1.0-4.0) was born
- How to input single quotation marks and double quotation marks in latex?
猜你喜欢
Knowledge payment applet dream vending machine V2
Routing decorator of tornado project
With excellent strength, wangchain technology, together with IBM and Huawei, has entered the annual contribution list of "super ledger"!
[kubernetes series] kubesphere is installed on kubernetes
Adaptive spatiotemporal fusion of multi-target networks for compressed video perception enhancement
Node foundation ~ node operation
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Introduction to rce in attack and defense world
Comparison between applet framework and platform compilation
How to share the source code anti disclosure scheme
随机推荐
Node connection MySQL access denied for user 'root' @ 'localhost' (using password: yes
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
Transition technology from IPv4 to IPv6
SQL foundation 9 [grouping data]
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
Practice (9-12 Lectures)
[freertos] freertos Learning notes (7) - written freertos bidirectionnel Link LIST / source analysis
Data double write consistency between redis and MySQL
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
System architecture design of circle of friends
【森城市】GIS数据漫谈(一)
输入年份、月份,确定天数
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
In the era of low code development, is it still needed?
Rhcsa day 3
jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
Rapidjson reading and writing JSON files
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
Zephyr study notes 2, scheduling
com. alibaba. nacos. api. exception. NacosException