CF6B--President‘s Office

原题链接--

 https://acs.jxnu.edu.cn/problem/CF6Bhttps://acs.jxnu.edu.cn/problem/CF6B

President's Office

 2000ms  65536K

描述:

President of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rectangular, and its sides are parallel to the office walls. One day President decided to establish an assembly, of which all his deputies will be members. Unfortunately, he does not remember the exact amount of his deputies, but he remembers that the desk of each his deputy is adjacent to his own desk, that is to say, the two desks (President's and each deputy's) have a common side of a positive length.

The office-room plan can be viewed as a matrix with n rows and m columns. Each cell of this matrix is either empty, or contains a part of a desk. An uppercase Latin letter stands for each desk colour. The «period» character («.») stands for an empty cell.

译文:伯兰的总统有一个非常大的办公室,除了他以外他的下属也在那里工作。 每个下属和总统都有他们自己的唯一颜色的办公桌。每个办公桌都是矩形的,它的每条边都平行于墙面。一天总统决定建立一个议会,所有议员都是成员。不幸地是他不记得议员的确切数量,但是他记得每个邻近他的办公桌的议员的办公桌,也就是说,两个办公桌(主席的和议员的)有一个正长度的共同边。

办公室能被看做一个n行m列的矩阵。每个矩阵的单元格要么是空的,要么包含一部分办公桌。一个大写的拉丁字母代表每个办公桌的颜色。字符《.》代表空白单元格。

输入:

The first line contains two separated by a space integer numbers nm (1 ≤ n, m ≤ 100) — the length and the width of the office-room, and c character — the President's desk colour. The following n lines contain m characters each — the office-room description. It is guaranteed that the colour of each desk is unique, and each desk represents a continuous subrectangle of the given matrix. All colours are marked by uppercase Latin letters.

译文:第一行包含两个由空格分隔的整数nm (1 ≤ n, m ≤ 100) —办公室的长度和宽度,和字符c—总统办公桌的颜色。接下来n行包含m个字符—办公室的描述。保证每个办公桌的颜色是唯一的,每个办公桌在矩阵中代表一个连续的子矩形。所有颜色通过拉丁字母标记。

输出:

Print the only number — the amount of President's deputies.

译文: 输出仅一个数字—总统的议员的数量。

样例输入:

3 4 R
G.B.
.RR.
TTT.

样例输出:

2

样例输入:

3 3 Z
...
.H.
..Z

样例输出:

0

你可能感兴趣的:(codeforces翻译题面,其他)