hello判断

描述

从键盘输入由5个字符组成的单词,判断此单词是不是hello,并显示结果。

输入

由5个字符组成的单词

输出

输出一句话: "this word is not hello!" 或者 "this word is hello!"。

输入样例 1

hello

输出样例 1

this word is hello!

输入样例 2

lello

输出样例 2

this word is not hello!

python3

python 复制代码
word = input().strip()
if word == "hello":
    print("this word is hello!")
else:
    print("this word is not hello!")    
    

c++

cpp 复制代码
#include <iostream>
#include <string>
#include <algorithm>

int main() {
    std::string word;
    std::cin >> word;

    // 移除首尾空白字符(如果需要)
    // word.erase(0, word.find_first_not_of(" \t"));
    // word.erase(word.find_last_not_of(" \t") + 1);

    if (word == "hello") {
        std::cout << "this word is hello!" << std::endl;
    } else {
        std::cout << "this word is not hello!" << std::endl;
    }

    return 0;
}
    
相关推荐
梅孔立8 分钟前
【实用教程】python 批量解析 EML 邮件文件 存成txt ,可以利用 AI 辅助快速生成年终总结
开发语言·python
c#上位机19 分钟前
C#异步编程之async、await
开发语言·c#
郑州光合科技余经理31 分钟前
实战分享:如何构建东南亚高并发跑腿配送系统
java·开发语言·javascript·spring cloud·uni-app·c#·php
爱装代码的小瓶子32 分钟前
【c++进阶】C++11新特性:一切皆可{}初始化
开发语言·c++·visual studio
yaoxin52112336 分钟前
273. Java Stream API - Stream 中的中间操作:Mapping 操作详解
java·开发语言·python
技术小甜甜36 分钟前
[Python实战] 告别浏览器驱动烦恼:用 Playwright 优雅实现网页自动化
开发语言·python·自动化
vortex537 分钟前
Bash 替换机制(一):命令替换与进程替换
开发语言·chrome·bash
小徐Chao努力42 分钟前
【GO】Gin 框架从入门到精通完整教程
开发语言·golang·gin
她说..44 分钟前
手机验证码功能实现(附带源码)
java·开发语言·spring boot·spring·java-ee·springboot
加成BUFF1 小时前
C++入门讲解3:数组与指针全面详解
开发语言·c++·算法·指针·数组