No.1362 [Zelkova 8th Tune] Black Sheep
タグ : / 解いたユーザー数 232
作問者 : 👑
Kazun
/ テスター :
Note
The problems of yukicoder contest 279 (Zelkova and Cherry) are not arranged in order of difficulty. Therefore, you are strongly encouraged to choose which problems to attempt based on publicly available information such as the problem statements, the number of stars indicating difficulty, and the number of accepted solvers.
Problem Statement
The given string $S$ consists of two kinds of characters, and all of its characters are the same except for one. At which position, counting from the left, is that one different character? Also, what is that character?
Input
The input is given from standard input in the following format.$S$
- $S$ is a string.
- $3 \leq |S| \leq 5 \times 10^5 \quad$ Here, $|S|$ denotes the length of the string $S$.
- Each character of $S$ is an uppercase English letter (
A-Z), a lowercase English letter (a-z), or a digit (0-9). - $S$ consists of two kinds of characters.
- All characters of $S$ are the same except for one.
Output
If the one different character in the given string $S$ is the $k$-th character from the left and that character is $\alpha$, output as follows.
$k\ \alpha$
The values must be separated by a space, and do not forget the newline at the end.
Sample
Sample 1
Input
WWWWBW
Output
5 B
In the given string, only the 5th character from the left is B, so output as above.
Sample 2
Input
PPPPPP3PPP
Output
7 3
Sample 3
Input
aaAa
Output
3 A
Note that uppercase and lowercase letters are distinguished.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。