Symmetric Brackets


Submit solution

Points: 40 (partial)
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem types
Allowed languages
Java 19, Java 8

題目說明

輸入一行含括號的字串

判斷括號是否對稱

輸入限制

字串,不含空格
括號種類為( )

輸入

含括號的字串

輸出

當找到非對稱的),輸出Asymmetric ')' bracket appears at index _(發現位置)_並結束程式

檢查完整行字串,還有(沒被對應到,輸出_(幾個)_ asymmetric '(' bracket(s)

此字串的括號完全對稱,輸出"_(此字串)_" have symmetric brackets

測試資料0 輸入

(4564(4564(5646)

測試資料0 輸出

2 asymmetric '(' bracket(s)

測試資料1 輸入

151)564(654)154)

測試資料1 輸出

Asymmetric ')' bracket appears at index 3

// index從0開始數

測試資料2 輸入

456(554)456(456(46))

測試資料2 輸出

"456(554)456(456(46))" have symmetric brackets

Comments

There are no comments at the moment.