题解 | 数颜色

数颜色

https://www.nowcoder.com/practice/7f458453debe49c9a98f20f42d65ebf1

import sys
s = list(input())
x = "R"
y = "G"
z = "B"
count1 = 0
count2 = 0
count3 = 0
for i in s:
    if i == x:
        count1 += 1
    elif i == y:
        count2 += 1
    elif i == z:
        count3 += 1
print(f"({count1},{count2},{count3})")

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务