1853 GongDui every where


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

GongDui 经常出现在各种各样的照片里

比如

http://www.jxxy.zjut.edu.cn/editor/attached/image/20121207/20121207132656_95537.jpg

还有 http://www.jxxy.zjut.edu.cn/editor/attached/image/20121207/20121207132945_37642.jpg

以及 http://www.jxxy.zjut.edu.cn/editor/attached/image/20121210/20121210105816_75823.jpg

嗯,现在你应该已经知道GongDui是谁了,让我们一起来找找他

Input

多组数据 每组第一行两个整数 m,n<=10代表照片的宽度和高度,照片的内容用大写英文字母表示,GongDui在照片里不喜欢躺着,所以如果你发现G下面有一个D,那就是找到了一个GongDui

Output

对于每组输入输出一个整数,代表你找到了几个GongDui

Sample

Input

2 2
GG
DD

2 2
GD
GD

Output

2
0

Source: Renkai


Comments

There are no comments at the moment.