#25069: 請幫幫我,NA訊息看不出哪裡錯


0520ryanyu (余秉侖)

學校 : 國立科學工業園區實驗高級中學
編號 : 122637
來源 : [101.10.95.73]
最後登入時間 :
2025-07-25 23:16:31

好像跟題目要得差點點但我不知道哪裡錯(訊息太長省略),請幫幫我看一下😰

謝謝~

#include<bits/stdc++.h>

using namespace std;

int main(){

string str;

string key;

string value;

cout << "{";

int p = 0;

while(cin>>str){

if(str == "insert"){

cin>>key>>value;

if(value != "newJSONObject"){

if(p!=0){

cout << ","; 

}

cout << key << ":"<< value;

p++;

}else{

cout <<","<< key << ":{";

p=0;

}

}else if(str == "end"){

cout << "}";

}

}

}