32分蒟蒻求助!

P1241 括号序列

jyz120609 @ 2022-08-14 11:57:57

#include <bits/stdc++.h>
using namespace std;
int main() {
    long long top=0;
    char a[100005];
    cin.getline(a,100005);
    int len=strlen(a);
    for(int i=0; i<=len; i++) {
        if(a[i]=='(') cout<<"()";
        else if(a[i]=='[') cout<<"[]";
    }
}

by zhangjingxing2012 @ 2022-08-14 19:36:21

建议你再读一遍题目


|