洛谷传送门:Image - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
难度:普及-(个人认为入门难度)
知识点:思维题
思路:统计不同字母的个数 ans,输出ans-1
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t; scanf("%d", &t);
string temp;
while(t--){
vector<int> arr(26,0);
cin>>temp;
arr[temp[0]-'a']++;
arr[temp[1]-'a']++;
cin>>temp;
arr[temp[0]-'a']++;
arr[temp[1]-'a']++;
int ans = -1;
for(int i = 0; i<26; i++){
if(arr[i]) ans++;
}
printf("%d\n",ans);
}
return 0;
}
/*
知识点:思维题
思路:统计不同字母的个数 ans,输出ans-1
心路历程:一眼看穿,水题练速度
9分钟切掉
3分钟读题,1分钟想题,5分钟写题
*/