2023 蓝桥杯热身赛

Problem P02. 异世界的文章(5分)

这学习,多是一件美事。果冻正在学习异世界的语言文字。他读到一篇有趣的文章。定义字符串子序列是不一定连续的子字符串,如对字符串 yisaigaisaiyii 是子序列, gs , ha 不是子序列。果冻尤其喜欢以 a 开头, k 结尾的三字词语,如 afkauk 。果冻想找到文章的所有子序列里有多少个子序列是这样的三字词语。

例如,假设文章为 idlikelanqiaoak ,那么其所有子序列中有 8a*k 三字词。

对于如下文章,求该文章的所有子序列里有多少个是这样的三字词语。(为避免你处理标点符号,我们已去除掉所有排版和标点符号)

icpcfinalisttizhuxianshengninhaoninhaoninhaoyoushenmeshiwomennengbangdaonitizhupazhuochuanqihuwoyaoshuodeshinimenqianwanbiehaipaicpcfinalistwomenshijinpaixuanshouwomenbuhuipaninqingshuotizhuwogangcaizaileetcodezhousaibaolingicpcfinalistnoiausuranqijingzhanshuhouyangicpcfinalistleetcodeshinayiweitizhubushinayiweijiushinagehenduohenduosuanfanantideleetcodenoiauhuachunoiptizhubushizhongxueshengdadeshidaxueshengdadenoiauhuachuicpctizhubutazaiwangluoshangdadebushixianchangsainoiauhuachucodeforcestizhutinemeiyingwendetashizhongwendenoiauhuachutopcodertizhuzheicpcfinalistduoguozhihuachunanchangyaoqingsaidemoyangzhongwendetizhuyishoubazhishanfeileetcodeasuanfayoumeiyouxuejiushinagehenduonantizuoliangbaidaojiunengjingugedeleetcodemingbaimaicpcfinalistmingbaileninjixushuotizhutafengkuangdichutinuewoshuowohencaishiwenshuibuzhidaoranhourangwozibijiushangzhouliunachangquanbudoushinantihaiyouxianduanshuxianduanshushujufanweinamedazhijierangwozuowonaqijianpanzhijiedalegebaolikuajiutlewojiuxiangrennoiaupuchitizhunixiaoshenmenoiauwoxiangqigaoxingdeshiqingtizhushenmegaoxingdeshiqingnoiauwodeguangyihouzhuizidongjiparentshushangdongtaidianfenzhiacleicpcfinalistpuchitizhuniyouxiaoshenmeicpcfinalistewodeaczidongjishanggaosixiaoyuanjiegailvdpfangchengyeacletizhunimenliangguodeshitongyigetinoiauduiduiduiicpcfinalistjiannandibiezhuxiaoabushishidouyongleshujujiegoutizhuwozaizhongshenyibianwomeizaikaiwanxiaonoiauduiduinoiauicpcfinalistmeirenzhuxiaochuleshengtizhuwaifengkuangqiaozhuoicpcfinalistwomenyanguizhengchuanninganggangshuodezhegeleetcodezhousaitananmetizhutabushinanbunandewentitazhendeshinazhonghenshaojiandenazhongtadetimuhenqiaomiaodongtaiguihuaerfendaanhenyouyisirangrenbaisibudeqijieyihandeshinatiantitaiduomeinengkanwannoiaubiexiaotizhuniqirentaishenworennihenjiulenoiauwodetiacletizhunimingmingzaixiaowonidoumeitingguonoiautizhuxianshengwomenshouguohenyangedexunlianwulunduohaoxiaonewomendoubuhuixiaochufeirenbuzhuzhuantoukanxiangicpcfinalisticpcfinalistburuzheyangtizhuxianshengninxianhuiqudengxiaoxiwomenyiyoujinzhanlimatongzhinintizhuhangnimenganjinquzuohennandeduodaidianrenjifangkuangxiaonoiautizhuxianshengninhaiyoushenmeyaobuchongmajifangkuangxiaoicpcfinalisttizhuxiansheng

输入

输出

你的答案

登录以提交代码。
单点时限 1 秒
内存限制 128 MB
提交 168
通过 53