A - abc of ABC
Problem Statement
You are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.
Constraints
|S|=3
S consists of a, b and c.
Input
Input is given from Standard Input in the following format:
S
Output
If S can be obtained by permuting abc, print Yes; otherwise, print No.
Sample Input 1
bac
Sample Output 1
Yes
Swapping the first and second characters in bac results in abc.
Sample Input 2
bab
Sample Output 2
No
Sample Input 3
abc
Sample Output 3
Yes
Sample Input 4
aaa
Sample Output 4
No
【解析】
第一题应该很好理解,也应该很快可以完成,就是一个暴力判定,就完。
AC代码:
#include<cstdio>
#define N 6
char s[N];
bool f[N];
int main()
{
scanf("%s",s);
for(int i=0;i<3;i++)
f[int(s[i]-97)]=1;
if(f[0]&&f[1]&&f[2]) printf("Yes\n");
else printf("No\n");
}
----------------------------------------------------------------