1210: Happiness

Time Limit: 1 Sec  Memory Limit: 1280 MB
Submit: 1149  Solved: 301
[Submit][Status][Web Board]

Description

Chicken brother is very happy today, because he attained N pieces of biscuits whose tastes are A or B. These biscuits are put into a box. Now, he can only take out one piece of biscuit from the box one time. As we all know, chicken brother is a creative man. He wants to put an A biscuit and a B biscuit together and eat them. If he take out an A biscuit from the box and then he take out a B biscuit continuously, he can put them together and eat happily. Chicken brother’s happiness will plus one when he eat A and B biscuit together one time.

Now, you are given the arrangement of the biscuits in the box(from top to bottom) ,please output the happiness of Chicken Brother when he take out all biscuit from the box.

Input

The first line is an integer indicates the number of test cases.

In each case, there is one line includes a string consists of characters ‘A’ and ‘B’.

The length of string is not more than 1000000.

Output

For each test case:

The first line output “Case #k:", k indicates the case number.

The second line output the answer.

Sample Input

1
ABABBBA

Sample Output

Case #1:
2

HINT

hzau 1210 Happiness的更多相关文章

  1. BZOJ 2127: happiness [最小割]

    2127: happiness Time Limit: 51 Sec  Memory Limit: 259 MBSubmit: 1815  Solved: 878[Submit][Status][Di ...

  2. [置顶] [BZOJ]2127: happiness 最小割

    happiness: Description 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科与理科有着自己 ...

  3. [补档]happiness

    happiness 题目 传送门:http://cogs.pro/cogs/problem/problem.php?pid=1873 高一一班的座位表是个n×m的矩阵,经过一个学期的相处,每个同学和前 ...

  4. happiness[国家集训队2011(吴确)]

    [试题来源] 2011中国国家集训队命题答辩 [问题描述] 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科 ...

  5. 【BZOJ2127】happiness(最小割)

    [BZOJ2127]happiness(最小割) 题面 Description 高一一班的座位表是个n*m的矩阵,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了, ...

  6. bzoj——2127: happiness

    2127: happiness Time Limit: 51 Sec  Memory Limit: 259 MBSubmit: 2570  Solved: 1242[Submit][Status][D ...

  7. 【BZOJ】【2127】happiness

    网络流/最小割 Orz Hzwer. 这题他题解说的比较简略……我手画了个图才明白过来…… 嗯对于每个人选文or理的单独收益大家应该很好理解……连S->i 权值为选文的喜悦值,i->T权值 ...

  8. A1261. happiness(吴确)[二元组暴力最小割建模]

    A1261. happiness(吴确) 时间限制:500ms   内存限制:512.0MB   总提交次数:158   AC次数:72   平均分:56.71   将本题分享到:        查看 ...

  9. 【bzoj2127】happiness 最大流

    happiness Time Limit: 51 Sec  Memory Limit: 259 MBSubmit: 2579  Solved: 1245[Submit][Status][Discuss ...

随机推荐

  1. CentOS 7.4 下设置定时任务

    cron介绍 我们经常使用的是crontab命令是cron table的简写,它是cron的配置文件,也可以叫它作业列表,我们可以在以下文件夹内找到相关配置文件. /var/spool/cron/ 目 ...

  2. zhparser是什么

    zhparser是什么 zhparser是一个PostgreSQL中文分词的插件,通过它,可以使PostgreSQL支持中文的全文检索(Full Text Search). 为什么需要zhparser ...

  3. 于win2008R2虽然激活,但是一个小时之后就会自动强制关机的问题

    写一个批处理文件: taskkill /f /im wlms.exeping -n  4 127.0.0.1shutdown -a 用记事本写下以上的命令,另存为.bat 批处理文件.双击运行,即可. ...

  4. iOS 根据农历日期 获取当前的农历年份 即 干支纪年法算农历年

    前言:我国古代是用干支纪年的,近代史上提到的甲午战争.戊戌变法.辛亥革命等名词就是干支纪年.所谓干支就是十天干和十二地支的简称.天干.地支按照一定规则(单配单,双配双)可以搭配成60对,也就是一个甲子 ...

  5. C# 调用VS自带程序WebDev.WebServer40.EXE 源代码

    通过Process.Start启动,VS自带程序WebDev.WebServer40.EXE 在内网架设网站时,为安装IIS条件下用VS自带的小程序来测试效果非常不错! using System; u ...

  6. 所有文本的 attributes 枚举,NSAttributedString

    // Predefined character attributes for text. If the key is not in the dictionary, then use the defau ...

  7. http://www.uupoop.com/ps/

    网页版PS,在线PS 基本的PS功能都有,最重要的一点是快,网页版的嘛,哼哼!

  8. Ubuntu16.04下编译android6.0源码

    http://blog.csdn.net/cnliwy/article/details/52189349 作为一名合格的android开发人员,怎么能不会编译android源码呢!一定要来一次说编译就 ...

  9. 自己动手编译Android源码(超详细)

    http://www.jianshu.com/p/367f0886e62b 在Android Studio代码调试一文中,简单的介绍了代码调试的一些技巧.现在我们来谈谈android源码编译的一些事. ...

  10. AngularJS 视图和路由

    在AngularJS之后引用angular-route  路由   ngRoute模块加载声明   AngularJS提供的when和otherwise两个方法来定义应用的路由   otherwise ...