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;
}

猜你喜欢

转载自blog.csdn.net/xiang_hehe/article/details/80609761