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