1039

作者: 峡迩 | 来源:发表于2017-09-03 11:07 被阅读0次
// PATn.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<iostream>
#include<string>
#include<map>

using namespace std;

map<char, unsigned> count_color(string tmp)
{
    map<char, unsigned> count_ret;
    for (auto r : tmp)
    {
        ++count_ret[r];
    }
    return count_ret;
}

int main()
{
    string offer;
    string need;

    cin >> offer >> need;

    map<char, unsigned> offer_count_color = count_color(offer);
    map<char, unsigned> need_count_color = count_color(need);

    unsigned yes_remind = offer.size()-need.size();
    unsigned no_need = 0;

    for (auto r : need_count_color)
    {
        if (offer_count_color.find(r.first) == offer_count_color.end())
        {
            no_need = no_need + r.second;
        }
        else
        {
            if (r.second > offer_count_color[r.first])
            {
                no_need = no_need + r.second - offer_count_color[r.first];
            }
        }
    }

    if (no_need != 0)
    {
        cout << "No " << no_need;
    }
    else
    {
        cout << "Yes " << yes_remind;
    }

    system("pause");
    return 0;
}

相关文章

  • 1039

  • 1039

    2022.10.31 星期一 多云 今早送云灿去站点儿然后做核酸。 这两天工作上比较忙碌,要干的事都挤...

  • 亲子(1039)

    2020.2.4 星期二 阴 今日立春 春天到了,愿扫除一切阴霾,还我们日朗风清,花香鸟鸣(〜^㉨...

  • 日记1039

    2022年11月23日,星期日 晴天 周日,完完全全属于自己的一天。儿子早上六点半出发上学,所以早上五点不到半起来...

  • 香菜好像不香了

    今天是来简书平台的第1039天,这篇文章是日更的第1039篇。今日天气晴天,心情一般。 去了趟超市,本想买菜做饭。...

  • vant 瀑布流滚动加载(搜索时onload不触发无法实现滚动加

    参考文章地址:https://blog.csdn.net/zjKnows/article/details/1039...

  • 储层/油藏的数据三维可视化系统

    引自:http://dxxy.yangtzeu.edu.cn/info/1039/1354.htm[http://...

  • error: RkExplorer: Must specify

    背景一、 今天编译android 9.0 的apk 出现 [1039/1081] including vend...

  • PAT A1039

    题目:https://pintia.cn/problem-sets/994805342720868352/prob...

  • 亲子日记1039

    2021.10.9 星期六 阴转小雨 批评教育 一味地批评教育是不可取的,今天蕊蕊的作业被点名了。其实个别的错误,...

网友评论

      本文标题:1039

      本文链接:https://www.haomeiwen.com/subject/ntgdjxtx.html