Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: cyblox_boi

Problemset: เรียงสตริง

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-16 08:55:56

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string text;
    cin >> text;

    string lowerText, capitalText;

    for (int i = 0; i < text.length(); i++)
    {
        if (islower(text[i]) && find(lowerText.begin(), lowerText.end(), text[i]) == lowerText.end())
        {
            lowerText += text[i];
        }
        else if (isupper(text[i]) && find(capitalText.begin(), capitalText.end(), text[i]) == capitalText.end())
        {
            capitalText += text[i];
        }
    }

    sort(capitalText.begin(), capitalText.end());
    sort(lowerText.begin(), lowerText.end());

    for (const char &i : capitalText)
    {
        cout << i << ' ';
    }

    for (const char &i : lowerText)
    {
        cout << i << ' ';
    }

    cout << '\n';

    return 0;
}