给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“GPLTGPLT....”这样的顺序输出,并忽略其它字符。当然,四种字符(不区分大小写)的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按GPLT的顺序打印,直到所有字符都被输出。

输入格式:

输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字符串。

输出格式:

在一行中按题目要求输出排序后的字符串。题目保证输出非空。

输入样例:

pcTclnGloRgLrtLhgljkLhGFauPewSKgt

输出样例:

GPLTGPLTGLTGLGLL
 #include<stdio.h>
#include<iostream>
#include<cstring>
using namespace std;
char GPLT[]={'G','P','L','T'};
int main()
{
char s[];
int gplt[];
for(int i=;i<;i++)
gplt[i]=;
cin>>s;
int len=strlen(s);
for(int i=;i<len;i++)
{
if(s[i]=='G'||s[i]=='g')
gplt[]++;
else if(s[i]=='P'||s[i]=='p')
gplt[]++;
else if(s[i]=='L'||s[i]=='l')
gplt[]++;
else if(s[i]=='T'||s[i]=='t')
gplt[]++;
}
int sum=gplt[]+gplt[]+gplt[]+gplt[];
while(sum--)
{
for(int i=;i<;i++)
if(gplt[i]!=)
{
printf("%c",GPLT[i]);
gplt[i]--;
}
}
printf("\n");
return ;
}

最新文章

  1. 【C#公共帮助类】给大家分享一些加密算法 (DES、HashCode、RSA、AES等)
  2. [转]spring beans.xml
  3. update the UI property cross thread
  4. 编辑器插件数据保存之Serializable
  5. Linux下的mongodb分片部署
  6. 安装 SQL SERVER PROFILER
  7. work_5
  8. (转载)四种常见的 POST 提交数据方式
  9. 转--Oracle DB 服务器系统时间修改问题与 SCN 关系的深入研究
  10. F题 - A+B for Input-Output Practice (V)
  11. Android开发知识体系总结
  12. Linux运维:安装CentOS7.2-图解
  13. mysql-innoDB-锁
  14. 元素化设计原理及规则v1.0
  15. 18 UI美化自定义主题样式代码
  16. PLC 数据类型
  17. js项目练习第二课
  18. Linux:Day8(上) 文件系统挂载和管理工具
  19. c# 数据存储过程
  20. CTFcrackTools-V3 - 一款旨在帮助 CTFer 在 CTF 中发挥作用的一个框架

热门文章

  1. js的eval函数解析后台返回的json数据时为什加上圆括号eval(&quot;(&quot;+data+&quot;)&quot;),而HTML页面定义的数据不用
  2. CrashMe分析教程1 - BreakPoint
  3. TypeScript 学习二 表达式和循环
  4. Linux下的数据监控工具
  5. react-router的基础知识
  6. intellij 出现“Usage of API documented as @since 1.6+”的解决办法
  7. layer ifram 弹出框
  8. magento获取一些值的方法函数
  9. Web Service接口返回泛型的问题(System.InvalidCastException: 无法将类型为“System.Collections.Generic.List`1[System.String]”的对象强制转换为类型“System.String[]”)
  10. 【Python】协程实现生产者消费者模型