結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー Mister
提出日時 2021-01-22 22:47:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 512 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 84,488 KB
最終ジャッジ日時 2025-01-18 05:11:04
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

void solve() {
    string s;
    cin >> s;

    map<char, int> cnt;
    for (char c : s) ++cnt[c];

    for (auto [c, p] : cnt) {
        if (p != 1) continue;
        cout << find(s.begin(), s.end(), c) - s.begin() + 1
             << " " << c << "\n";
        return;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0