結果

提出番号 1081
提出者 tone_back
言語 C++
提出日時 2017-12-03 21:36:09
問題名 (50)文字列中に含まれる文字種の数
結果 AC
点数 100%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 1ms 8288KB
2 AC 100% 2ms 8048KB
3 AC 100% 2ms 8432KB
4 AC 100% 2ms 8432KB
5 AC 100% 2ms 8720KB
6 AC 100% 2ms 8112KB

ソースコード

#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	string s;
	cin >> s;
	int len = s.length();
	int alpha[26] = {};
	int answer = 0;

	for (int i = 0; i < len; i++) {
		for (int j = 0; j < 26; j++) {
			if (s[i] == 'a' + j) {
				alpha[j]++;
			}
		}
	}
	for (int i = 0; i < 26; i++) {
		if (alpha[i] > 0) {
			answer++;
		}
	}
	cout << answer;

	return 0;
}