9 条题解
-
1
#include <stdio.h> #include <iostream> #include <algorithm> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int len = s.length(); int ans = 0; int a = 0, b = 0; for (int i = 0 ; i < len ; i++) { if (s[i] == '(') { a = i; } if (s[i] == ')') { b = i; for (int j = a + 1 ; j <= b - 1 ; j++) { if (s[j] >= 'a' && s[j] <= 'z') { ans++; } } } } cout << ans << '\n'; } return 0; }
信息
- ID
- 211
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 1756
- 已通过
- 215
- 上传者