02.12 President‘s Office

President's Office | JXNUOJicon-default.png?t=M0H8https://acs.jxnu.edu.cn/problem/CF6B

描述:

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.

第一行包含两个,中间用空格整数数字‎‎n‎‎,‎‎m‎‎(‎‎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

你可能感兴趣的:(英文题目翻译,c++)