#32813: ans


yp11151049@yphs.tp.edu.tw (801-24)

學校 : 臺北市私立延平高級中學
編號 : 197224
來源 : [203.72.178.1]
最後登入時間 :
2024-01-16 09:26:24
b524. 先別管這個了,你聽過yee嗎? -- 104學年度板橋高中校內資訊學科能力競賽(一) | From: [203.72.178.1] | 發表日期 : 2022-11-09 17:16

#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    string s;
    while(cin>>s){
        int p=0,ans=0;
        for(int i=0;i<s.length();i++)
        if(s[i]=='y') {ans+=abs(i-p); p+=3;}
        cout<<ans<<'\n';
    }
}

 
ZeroJudge Forum