zoukankan      html  css  js  c++  java
  • UVa1339 Ancient Cipher

    #include <iostream>
    #include <string>
    #include <cstring> // for memset
    #include <algorithm>
    using namespace std;

    int main()
    {
        int ce[26], co[26];
        string encrypted, orginal;
        string::size_type i, len;
        ios::sync_with_stdio(false);
        while (cin >> encrypted >> orginal)
        {
            memset(ce, 0, sizeof(ce));
            memset(co, 0, sizeof(co));
            len = orginal.length();
            for (i = 0; i < len; ++i)
            {
                ++ce[encrypted[i]-'A'];
                ++co[orginal[i]-'A'];
            }
            
            sort(ce, ce+26);
            sort(co, co+26);
            if (equal(ce, ce+26, co))
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }
        return 0;
    }

  • 相关阅读:
    fort循环
    while
    函数和数组
    case
    init进程
    权限安全:堡垒机部署实践
    tcp首部当中seq和ack的增长规律
    VRRP
    MSTP
    字符集专题
  • 原文地址:https://www.cnblogs.com/danny1221/p/4603991.html
Copyright © 2011-2022 走看看