Untitled
unknown
plain_text
a year ago
493 B
6
Indexable
#include <iostream>
using namespace std;
typedef long long ll;
int d, cnt, a[1000001];
int main(){ // O(n^2) DEMXAU
freopen("DEMXAU.INP","r",stdin);
freopen("DEMXAU.OUT","w",stdout);
string s; cin >> s; int n = s.size();
cnt = 0;
for(int i = 0; i < n; i++){
d = 0;
for(int j = i; j < n; j++){
if(s[j] >= 48 && s[j] <= 57) d--;
else d++;
if(d > 0) cnt++;
}
}
cout << cnt << endl;
return 0;
}Editor is loading...
Leave a Comment