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. tfboys——tensorflow模块学习(二)

    tf.contrib模块 tf.contrib 模块是一个比较复杂的模块. contrib细节: tf.contrib.bayesflow.entropy  香农信息论 tf.contrib.baye ...

  2. 20170517 ABAP debug

    1.新版本调试模式下的观察点: 在新版本模式画面的工具栏上选择'watchpoint' 按钮可以创建观察点. 举例:当生产内表itab第5行时,设置为观察点,追加条件如下: Lines(itab) = ...

  3. 安卓手机开机键失灵,FASTBOOT模式ADB重启

    安装ADB工具 CMD指令fastboot reboot

  4. ACM解题之(ZOJ 2212) Argus

    题目来源: 点击打开题目 题目翻译: 数据流是实时的,连续的,有序的项目序列.一些例子包括传感器数据,互联网流量,金融代码,在线拍卖以及诸如网络使用日志和电话记录之类的交易日志.同样,对流进行的查询在 ...

  5. Eclipse部署项目的时候抛异常【Multiple Contexts have a path of "/cdcpm".】

    Eclipse部署项目的时候抛异常[Multiple Contexts have a path of "/cdcpm".]重新clean .删除server都不好使.查看一下tom ...

  6. MySQL数据库(4)_MySQL数据库外键约束、表查询

    一.外键约束 创建外键 --- 每一个班主任会对应多个学生 , 而每个学生只能对应一个班主任 ----主表 CREATE TABLE ClassCharger( id TINYINT PRIMARY ...

  7. idea java web 使用说明

    String realPath = request.getSession().getServletContext().getRealPath(uploadPath);//上传压缩包所在目录       ...

  8. yii常用操作函数

    <?php defined('YII_DEBUG') or define('YII_DEBUG', true); //当在调试模式下,应用会保留更多日志信息,如果抛出异常,会显示详细的错误调用堆 ...

  9. <script>放在head内和body内有什么区别

    加载的顺序不一样,你可以把HTML看成从上往下加载的. 例如在网速慢的情况下把js代码放在body底部用户会先看到网页结构,等js加载完成后才出现特效 区别简述: 在HTML body部分中的Java ...

  10. 20145230《java程序设计》 第四次实验报告

    20145230实验4 Android开发基础 实验内容 基于Android Studio开发简单的Android应用并部署测试; 了解Android组件.布局管理器的使用: 掌握Android中事件 ...