Submission #18072364


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

bool is_ATGC(char c)
{
    switch (c) {
        case 'A':
        case 'T':
        case 'G':
        case 'C':
            return true;
    }
    return false;
}

bool is_ATGC(const string &S, int i, int j)
{
    for (int k = i; k <= j; ++k) {
        if (!is_ATGC(S.at(k)))
            return false;
    }
    return true;
}
     
int main()
{
    string S;
    cin >> S;
    int N = S.size();
    int max_len = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i; j < N; ++j) {
            if (!is_ATGC(S, i, j))
                continue;
            int len = j - i + 1;
            if (max_len < len)
                max_len = len;
        }
    }
    cout << max_len << endl;
}

Submission Info

Submission Time
Task B - ATCoder
User atug
Language C++ (GCC 9.2.1)
Score 200
Code Size 739 Byte
Status AC
Exec Time 8 ms
Memory 3588 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 8 ms 3428 KiB
a02 AC 2 ms 3528 KiB
a03 AC 2 ms 3576 KiB
b04 AC 2 ms 3416 KiB
b05 AC 2 ms 3588 KiB
b06 AC 3 ms 3444 KiB
b07 AC 2 ms 3572 KiB
b08 AC 2 ms 3384 KiB
b09 AC 2 ms 3428 KiB
b10 AC 2 ms 3448 KiB
b11 AC 3 ms 3444 KiB
b12 AC 2 ms 3572 KiB
b13 AC 2 ms 3428 KiB