UVA 1339 sort ent cipher [sort]

Source: Internet
Author: User

/*
Old password for Chinese questions
You can see if you can change the location of the first character to exactly match the 26 letters of the second character.
Solution: count the number of characters in two strings. If the number of characters in each string is the same, yes is output; otherwise, no is output.
Difficulties: it is a little difficult to count the number of times each character appears.
Key Point: Sorting
Problem solving person: lingnichong
Solution time:
Experience in solving problems: a good question
*/



1339-maximum ent ciphertime limit: 3.000 seconds


 
# Include <stdio. h> # include <string. h ># include <algorithm> using namespace STD; char cot1 [300], cot2 [300]; int A [30], B [30]; int main () {int I, L, len1, len2; while (~ Scanf ("% S % s", cot1, cot2) {memset (A, 0, sizeof (a); memset (B, 0, sizeof (B )); len1 = strlen (cot1); len2 = strlen (cot2); If (len1> len2) L = len1; else l = len2; for (I = 0; I <L; I ++) {++ A [cot1 [I]-'a']; ++ B [cot2 [I]-'a'];} Sort (, A + 26); sort (B, B + 26); for (I = 0; I <26; I ++) if (a [I]! = B [I]) break; printf (I = 26? "Yes \ n": "No \ n");} return 0 ;}



UVA 1339 sort ent cipher [sort]

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.