Submission

Status:

[-SSS][-][-][-][-]

Subtask/Task Score:

{0/20}{0/20}{0/20}{0/20}{0/20}

Score: 0

User: KanemiyaKana

Problemset: นก

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-03 16:52:22

#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main ()
{
    int amount;
    string output = "";
    cin >> amount;
    cin.ignore();
    if (amount < 2 || amount > 1000)
    {
        cout << "amount is outside of the supported amount.";
        return 0;
    }
    string total[amount];
    for (int i = 0; i < amount; i++)
    {
        string input;
        getline(cin, input);
        if (input.length() > 200 || input.length() < 1)
        {
            cout << "input is longer than supported.";
            return 0;
        }
        for (int j = 0; j < input.length(); j++)
        {
            if (input[j] == ' ' || !isalpha(input[j]))
            {
                cout << "input format is not supported. (you either have a space or a non alphabetical character)";
                return 0;
            }
        }
        total[i] = input;
    }
    string starter = total[0];
    int count = 0;
    for (int i = 0; i < starter.length(); i++)
    {
        char currentchar = starter[i];
        bool doesitmatch = true;
        for (int j = 1; j < amount; j++)
        {
            if (i >= total[j].length() || currentchar != total[j][i])
            {
                doesitmatch = false;
                break;
            }
        }
        if (doesitmatch)
        {
            count++;
            output += currentchar;
        }
    }
    if (output == "")
    {
        cout << "-";
    }
    else
    {
        cout << output;
    }
}