#include using namespace std; int main(void) { string s; cin >> s; int result = 0; int temp = 0; for(auto c = s.begin(); c != s.end(); c++) result += (temp = (*c == '1' ? temp + 1 : 0)); cout << result << endl; return 0; }
C++11
문제 https://arca.live/b/quiz/773657