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. Sonya and Robots CodeForces - 1004C (思维题)

    Sonya and Robots time limit per test 1 second memory limit per test 256 megabytes input: standard in ...

  2. 笔记-python-变量作用域

    笔记-python-变量作用域 1.      python变量作用域和引用范围 1.1.    变量作用域 一般而言程序的变量并不是任何对象或在任何位置都可以访问的,访问权限决定于这个变量是在哪里赋 ...

  3. (ADO.NET)SqlCommand参数化查询

    string strcon = "Persist Security Info=False;User id=sa;pwd=lovemary;database=student;server=(l ...

  4. 用私有构造器或者枚举类型强化Singleton属性

    1.Singleton指仅仅被实例化一次的类.Singleton通常被用来代表那些本质上唯一的系统组件,如窗口管理器或者文件系统.使类称为Singleton会使它的客户端调试变的十分困难,因为无法给S ...

  5. Android开发——常见的内存泄漏以及解决方案(二)

    )Android2.3以后,SoftReference不再可靠.垃圾回收期更容易回收它,不再是内存不足时才回收软引用.那么缓存机制便失去了意义.Google官方建议使用LruCache作为缓存的集合类 ...

  6. 3 View视图 URLconf

    1.视图 视图接受Web请求并且返回Web响应 视图就是一个python函数,被定义在views.py中 响应可以是一张网页的HTML内容,一个重定向,一个404错误等等 响应处理过程如下图: 2 准 ...

  7. day20 Django Models 操作,多表,多对多

    1 Django models 获取数据的三种方式: 实践: viwes def business(request): v1 = models.Business.objects.all() v2 = ...

  8. loj2291 「THUSC 2016」补退选

    ref pkusc 快到了,做点 thusc 的题涨涨 rp-- #include <iostream> #include <cstring> #include <cst ...

  9. Linux 基础命令、文档树 和 bash

    最近发现了一个总结得更好的:bash cheatsheet 本文只是我对 linux 基础学习的一个总结,可能仅适用于复习用.算是我的 Linux 备忘录. 最基础 tab 补全 * 通配符 ctrl ...

  10. redis命令monitor详解

    通过monitor这个命令可以查看数据库在当前做了什么操作,对于管理redis数据库有这很大的帮助 如图示,在redis客户端进行操作显示info,另一个窗口打开monitor就会显示出这个命令的操作 ...