Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.7 kB
5
Indexable
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
 
using namespace std;
 
 
int main()
{
    int n;
    char temp[11];
    char a[1001][11];
    char gp[101];
    int maincount = 0;
    int count1 = 0;
    int count2 = 0;
    bool fd1 = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        (void)scanf("%s", a[i]);
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ) {
            int k = 0;
            while (a[i][k] != '\0' && a[j][k] != '\0' && a[i][k] == a[j][k]) {
                k++;
            }
            if (a[i][k] == '\0' && a[j][k] == '\0') {
                int l = 0;
                while (a[j][l] != '\0') {
                    a[j][l] = a[n - 1][l];
                    l++;
                }
                a[n - 1][0] = '\0';
                n--;
            }
            else {
                j++;
            }
        }
    }
    (void)scanf("%s", gp);
    for (int i = 0; i < n; i++)
    {
        char gp1[100] = { 0 };
        for (int f = 0; (gp[f] > 64 && gp[f] < 91) || (gp[f] > 91 && gp[f] < 123); f++)
        {
            gp1[f] = gp[f];
        }
        for (int j = 0; (a[i][j] > 64 && a[i][j] < 91) || (a[i][j] > 91 && a[i][j] < 123); j++)
        {
            for (int y = 0; (gp1[y] > 64 && gp1[y] < 91) || (gp1[y] > 91 && gp1[y] < 123); y++)
            {
                if (gp1[y] == a[i][j]) {
                    count1++;
                    gp1[y] = 'A';
                }
            }
            count2++;
        }
        if (count1 == count2) maincount++;
        count1 = 0;
        count2 = 0;
    }
    cout << maincount;
 
}