为什么我的代码在Code Chef上不起作用,尽管它在我的本地计算机上运行良好

问题描述 投票:0回答:1

问题网址:https://www.codechef.com/JUNE20B/problems/XYSTR

厨师和字符串问题代码:XYSTR

它通过了所有显示的测试用例,但仍然无法正常工作。

for _ in range(int(input())):
    string = str(input())
    substring = 'xy'
    count = string.count(substring)
    print(count)
python-3.x
1个回答
0
投票

您不算'yx'。按照您的代码,yxyx仅产生1,但正确答案为2。

© www.soinside.com 2019 - 2024. All rights reserved.