POJ 2159 Ancient Cipher

Source: Internet
Author: User

Test instructions: Was killed by test instructions ... orz ..... That substitution is not an ASCII code plus a few ... is to randomly change to another character ...

Solution: Just count the number of occurrences of each letter and then sort the array teller.

Code:

#include <stdio.h> #include <iostream> #include <algorithm> #include <string> #include < string.h> #include <math.h> #include <limits.h> #include <time.h> #include <stdlib.h># include<map> #include <queue> #include <set> #include <stack> #include <vector> #define LL Long longusing namespace Std;int main () {    string s1, S2;    while (CIN >> s1 >> S2)    {        vector <int> v1, v2;        for (int i = 0; i <; i++)        {            v1.push_back (0);            V2.push_back (0);        }        for (int i = 0; i < s1.size (); i++)        {            v1[s1[i]-' A ']++;            V2[s2[i]-' A ']++;        }        Sort (V1.begin (), V1.end ());        Sort (V2.begin (), V2.end ());        if (v1 = = V2) puts ("YES");        Else puts ("NO");    }    return 0;}

  

POJ 2159 Ancient Cipher

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.