Codeforces Round #485 (Div. 2)——A. Infinity Gauntlet【stl,map】

A. Infinity Gauntlet
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:

  • the Power Gem of purple color,
  • the Time Gem of green color,
  • the Space Gem of blue color,
  • the Soul Gem of orange color,
  • the Reality Gem of red color,
  • the Mind Gem of yellow color.

Using colors of Gems you saw in the Gauntlet determine the names of absent Gems.

Input

In the first line of input there is one integer nn (0n60≤n≤6) — the number of Gems in Infinity Gauntlet.

In next nn lines there are colors of Gems you saw. Words used for colors are: purplegreenblueorangeredyellow. It is guaranteed that all the colors are distinct. All colors are given in lowercase English letters.

Output

In the first line output one integer mm (0m60≤m≤6) — the number of absent Gems.

Then in mm lines print the names of absent Gems, each on its own line. Words used for names are: PowerTimeSpaceSoulRealityMind. Names can be printed in any order. Keep the first letter uppercase, others lowercase.

Examples
input
Copy
4
red
purple
yellow
orange
output
Copy
2
Space
Time
input
Copy
0
output
Copy
6
Time
Mind
Soul
Power
Reality
Space
Note

In the first sample Thanos already has RealityPowerMind and Soul Gems, so he needs two more: Time and Space.

In the second sample Thanos doesn't have any Gems, so he needs all six.


Codeforces (c) Copyright 2010-2018 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Jun/07/2018 15:12:11 UTC+8 (d3).
Desktop version, switch to  mobile version.

Privacy Policy

这道题看输出就可以猜出大致题意,就是用map存一下对应关系就可以了。

#include<bits/stdc++.h>
using namespace std;
map<string,string> ma;
int main(){
    ma.insert(make_pair("purple","Power"));
    ma.insert(make_pair("green","Time"));
    ma.insert(make_pair("blue","Space"));
    ma.insert(make_pair("orange","Soul"));
    ma.insert(make_pair("red","Reality"));
    ma.insert(make_pair("yellow","Mind"));
    int n;
    cin>>n;
    string s;
    while(n--){
        cin>>s;
        ma.erase(s);
    }
    int sum=ma.size();
    cout<<sum<<endl;
    map<string,string>::iterator ite;
    for(ite=ma.begin();ite!=ma.end();ite++){
        cout<<ite->second<<endl;
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值