#45015: yee個只有那麼yee點點用的答案


yp11351100@yphs.tp.edu.tw (801-28胡可岳)

學校 : 臺北市私立延平高級中學
編號 : 276234
來源 : [45.38.17.252]
最後登入時間 :
2025-08-06 14:37:29

#include<stdio.h>
#include<string.h>

int abs(int x){
    if (x<0)return -x ;
    return x ;
}

char s[100030] ;

int main(){
    while (~scanf("%s",s)){
        int ans=0 ,cnt=0 ,i ;
        for (i=0 ;s[i]>0;i++ )if(s[i]=='y'){
            ans+=abs(cnt++*3-i) ;
        }
        printf("%d\n",ans ) ;
    }
}