C.Cheering

To boost contestants' performances in the 20th La Salle - Pui Ching Programming Challenge, the organizers have bought N robots to cheer for them. Each robot is supposed to display cheering slogans, letter by letter.

Unfortunately, due to some technical reasons, the display screen of each robot can only display one fixed character. Therefore, the organizers decided to arrange the robots in a row, thus forming a string of N letters (What a waste!). All letters are in uppercase.

The two hosting schools have abbreviated names LSC and PCMS, as we all know. Which of the two names appear (as a substring) in the string more often?

Input

The first and only line of input consists of a string with N uppercase letters.

For all test cases, N ≤ 100.

Output

Let A be the number of occurrences of LSC in the given string.

Let B be the number of occurrences of PCMS in the given string.

If A > B, output LSC.

If A < B, output PCMS.

If A = B, output Tie.

Example

Input
GOLSC
Output
LSC
Input
PCMSISTHEBEST
Output
PCMS
Input
PCMSWILLNEVERBEATLSC
Output
Tie
Input
ADDOILEVERYONE
Output
Tie

代码:

 1 #include<iostream>
2 #include<cstring>
3 #include<cstdio>
4 #include<cmath>
5 #include<algorithm>
6 using namespace std;
7 const int N=1e5+10;
8 char s[N];
9 int main(){
10 memset(s,0,sizeof(s));
11 while(~scanf("%s",s)){
12 int len=strlen(s);
13 int num1=0,num2=0;
14 for(int i=0;i<len;i++){
15 if(s[i]=='L'){
16 if(s[i+1]=='S'&&s[i+2]=='C'&&i+2<len)num1++;
17 }
18 if(s[i]=='P'){
19 if(s[i+1]=='C'&&s[i+2]=='M'&&s[i+3]=='S'&&i+3<len)num2++;
20 }
21 }
22 if(num1>num2)printf("LSC\n");
23 else if(num1<num2)printf("PCMS\n");
24 else printf("Tie\n");
25 }
26 return 0;
27 }

Codeforces Gym101522 C.Cheering-字符串 (La Salle-Pui Ching Programming Challenge 培正喇沙編程挑戰賽 2017)的更多相关文章

  1. Codeforces Gym101522 D.Distribution of Days-算日期 (La Salle-Pui Ching Programming Challenge 培正喇沙編程挑戰賽 2017)

    D.Distribution of Days The Gregorian calendar is internationally the most widely used civil calendar ...

  2. Codeforces Gym101522 A. Ambiguous Dates (La Salle-Pui Ching Programming Challenge 培正喇沙編程挑戰賽 2017)

    A. Ambiguous Dates There are two popular formats for representing a date: day/month/year or month/da ...

  3. gym101522 [小熊骑士限定]La Salle-Pui Ching Programming Challenge 培正喇沙編程挑戰賽 2017

    西瓜队(划掉),Kuma Rider久违的第一场训练,四小时瞎打.jpg A.水题,排序 #include<cstdio> #include<iostream> #includ ...

  4. Codeforces 176B (线性DP+字符串)

    题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=28214 题目大意:源串有如下变形:每次将串切为两半,位置颠倒形成 ...

  5. Codeforces 316G3 Good Substrings 字符串 SAM

    原文链接http://www.cnblogs.com/zhouzhendong/p/9010851.html 题目传送门 - Codeforces 316G3 题意 给定一个母串$s$,问母串$s$有 ...

  6. Codeforces 1090B - LaTeX Expert - [字符串模拟][2018-2019 Russia Open High School Programming Contest Problem B]

    题目链接:https://codeforces.com/contest/1090/problem/B Examplesstandard input The most famous characters ...

  7. CodeForces 1056E - Check Transcription - [字符串hash]

    题目链接:https://codeforces.com/problemset/problem/1056/E One of Arkady's friends works at a huge radio ...

  8. codeforces 883H - Palindromic Cut - [字符串处理]

    题目链接:http://codeforces.com/problemset/problem/883/H Time limit: 3000 ms Memory limit: 262144 kB Koly ...

  9. codeforces#1183H. Subsequences(字符串dp)

    题目链接: http://codeforces.com/contest/1183/problem/H 题意: 给出一个长度为$n$的字符串,得到$k$个子串,子串$s$的花费是$n-|s|$ 计算最小 ...

随机推荐

  1. Java面向对象---泛型

    概念 泛型可以解决数据类型的安全问题,主要原理是在类声明的时候通过一个标识表示类中某个属性的类型或者是某个方法的返回值及参数类型. 格式 访问权限 class 类名称<泛型,泛型...>{ ...

  2. 浅谈我所见的CSS组织风格

    1.简单组织(见习级) projectName ├─css | └style.css 优点:简单,单一文件,适合一些简单项目. 缺点:过度集中,没有模块化,无法适应大型项目. 2.公共组织(见习级) ...

  3. CentOS 7使用dnf安装Memcached以及启动、停止、开机启动等设置

    1.安装Memcached dnf install memcached 根据提示完成安装 2.启动Memcached 输入以下命令: service memcached start 输出以下内容: R ...

  4. Vue+Django REST framework打造生鲜电商项目

    1-1 课程导学 2-1 Pycharm的安装和简单使用 2-2 MySQL和Navicat的安装和使用 2-3 Windows和Linux下安装Python2和Python3 2-4 虚拟环境的安装 ...

  5. 04 JVM是如何执行方法调用的(下)

    虚方法调用 Java 里所有非私有实例方法调用都会被编译成 invokevirtual 指令,而接口方法调用会被编译成 invokeinterface 指令.这两种指令,均属于 Java 虚拟机中的虚 ...

  6. 精通CSS高级Web标准解决方案(3-1 背景图像与图像替换)

    3.1背景图像基础 3.2图像替换 使用文本的图像并保留文本的方法.

  7. [python工具][pycharm]pycharm licence activation失效的解决方法

    推荐网站: http://idea.lanyus.com/ 1 请将“0.0.0.0 account.jetbrains.com”添加到C:\Windows\System32\Drivers\etc\ ...

  8. pandas神坑:如果列有NAN,则默认给数据转换为float类型!给pandas列指定不同的数据类型。

    今天碰到一个错误,一个字典取值报keyError, 一查看key, 字符串类型的数字后面多了小数点0, 变成了float的样子了. 发现了pandas一个坑:如果列有NAN,则默认给数据转换为floa ...

  9. POJ-2159 最小费用最大流

                                                        Going Home 自己写的第一道费用流,图建好一波板子AC.不过还是有几个地方有点迷. 先来 ...

  10. CH Round #59 - OrzCC杯NOIP模拟赛day1

    第一题:队爷的新书 题意简述:给定n个闭区间,求出一个数p使它与包含它的区间数的积最大,输出这个积. 分析:使用一个差分数组g,每个区间[l,r],l位置加1,r+1的位置减1,从前往后统计,得到对于 ...