989A A Blend of Springtime

A. A Blend of Springtime
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
When the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.

"What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone."

"But these blends are at their best, aren't they?" Absorbed in the landscape, Kanno remains optimistic.

The landscape can be expressed as a row of consecutive cells, each of which either contains a flower of colour amber or buff or canary yellow, or is empty.

When a flower withers, it disappears from the cell that it originally belonged to, and it spreads petals of its colour in its two neighbouring cells (or outside the field if the cell is on the side of the landscape). In case petals fall outside the given cells, they simply become invisible.

You are to help Kanno determine whether it's possible that after some (possibly none or all) flowers shed their petals, at least one of the cells contains all three colours, considering both petals and flowers. Note that flowers can wither in arbitrary order.

Input

The first and only line of input contains a non-empty string ss consisting of uppercase English letters 'A', 'B', 'C' and characters '.' (dots) only (|s|100|s|≤100) — denoting cells containing an amber flower, a buff one, a canary yellow one, and no flowers, respectively.

Output

Output "Yes" if it's possible that all three colours appear in some cell, and "No" otherwise.

You can print each letter in any case (upper or lower).

Examples
input
Copy
.BAC.
output
Copy
Yes
input
Copy
AA..CB
output
Copy
No
Note

In the first example, the buff and canary yellow flowers can leave their petals in the central cell, blending all three colours in it.

In the second example, it's impossible to satisfy the requirement because there is no way that amber and buff meet in any cell.



题意:一朵花有三种颜色,ABC,现在花凋谢了,也就是这些颜色会消失,让你判断有没有可能有一朵花三种颜色都在。

题解:模拟 再输入的一串字符串里面判断里面有ABC的全排列。

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s.find("ABC")!=s.npos||s.find("ACB")!=s.npos||s.find("BAC")!=s.npos||s.find("BCA")!=s.npos||s.find("CAB")!=s.npos||s.find("CBA")!=s.npos)
        puts("Yes");
    else  puts("No");
    return 0;
}


s=input()
if "ABC" in s or "ACB" in s or "BAC" in s or "BCA" in s or "CAB" in s or "CBA" in s:
    print("YES")

else:
    print("NO")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

落凡尘.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值