Thursday, July 3, 2014

Codeforces Round #101 (Div. 2), problem: (A) Amusing Joke solution

Codeforces Round #101 (Div. 2), problem: (A) Amusing Joke: http://codeforces.com/problemset/problem/141/A

Codeforces Round #101 (Div. 2), problem: (A) Amusing Joke editorial: http://codeforces.com/blog/entry/3571

Codeforces Round #101 (Div. 2), problem: (A) Amusing Joke solution: http://ideone.com/B0nSfp

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
    int d[30]={0}, e[30]={0}, f[30]={0}, cnt=0, flag=0;
    char a[105], b[105], c[105];
    scanf("%s%s%s", a, b, c);
    for(int i=0; i<strlen(a); i++) d[a[i]-'A']++;
    for(int i=0; i<strlen(b); i++) e[b[i]-'A']++;
    for(int i=0; i<strlen(c); i++) f[c[i]-'A']++;
    for(int i=0; i<30; i++) if(d[i]+e[i]!=f[i]) {flag=1; break;}
    if(flag) printf("NO");
    else printf("YES");
    return 0;
}

No comments:

Post a Comment