- 0
- 0
- 约1.59千字
- 约 4页
- 2026-02-05 发布于北京
- 举报
基础练习字符串对比
时间限制:1.0s内存限制:512.0MB
问题描述
给定两个仅由大写字母或小写字母组成的字符串(长度介于1到10之间),
它们之间的关系是以下4中情况之一:
1:两个字符串长度不等。比如Beijing和Hebei
2:两个字符串不仅长度相等,而且相应位置上的字符完全一致(区分大小
写),比如Beijing和Beijing
3:两个字符串长度相等,相应位置上的字符仅在不区分大小写的前提下才
能达到完全一致(也就是说,它并不满足情况2)。比如beijing和BEIjing
4:两个字符串长度相等,但是即使是不区分大小写也不能使这两个字符串
一致。比如Beijing和Nanjing
编程判断输入的两个字符串之间的关系属于这四类中的哪一类,给出所属的
类的编号。
输入格式
包括两行,每行都是一个字符串
输出格式
仅有一个数字,表明这两个字符串的关系编号
样例输入
BEIjing
beiJing
样例输出
3
BasicPracticeStringComparison
TimeLimit:1.0sMemoryLimit:512.0MB
问题描述
Giventwostringsconsistingonlyofuppercaseorlowercaseletters(length
ween1and10),theirrelationshipfallsintooneofthefollowing4cases:
1:Thetwostringshavedifferentlengths.Forexample,BeijingandHebei
2:Thetwostringsnotonlyhavethesamelength,butalsothecharactersatcorres
pondingpositionsareexactlythesame(case-sensitive),suchasBeijingandBeijing
3:Thetwostringshavethesamelength,andthecharactersatcorrespondingpositionsareidenticalonly
whencaseisignored(thatis,itdoesnotmeetcondition2).Forexample,beijingandBEIjing
4:Thetwostringshavethesamelength,butevenwhencaseisignored,these
twostringscannotbemadeidentical.Forexample,BeijingandNanjing.
Determinetherelationshipweenthetwoinputstringsandidentifywhichof
thefourcategoriestheybelongto,providingthenumberofthecategory.
输入格式
Consistsoftwolines,eachlinebeingastring.
输出格式
Thereisonlyonenumber,indicatingthe
relationshipnumberweenthesetwostrings.
Sampleinput:BEIjingbeiJing
Sample
output:3
您可能关注的文档
最近下载
- AMS2315G 国外国际标准规范.pdf VIP
- 二手车鉴定评估报告表.pdf VIP
- 会议记录表-模板.xlsx VIP
- 生产安全重大事故隐患判定标准宣贯培训记录.docx VIP
- 2026年商丘职业技术学院单招职业技能考试题库含答案详解.docx VIP
- 考试三类职业适应性测试试题.docx VIP
- 009 水泵控制柜合格证及检验报告.pdf VIP
- T∕ZZB 1762-2020 恒温混水阀标准规范.docx VIP
- 人教版(2026春新教材)二年级下册语文教案全册.docx
- 中国国家标准 GB/T 11017.1-2024额定电压66 kV(Um=72.5 kV)和110 kV(Um=126 kV)交联聚乙烯绝缘电力电缆及其附件 第1部分:试验方法和要求.pdf
原创力文档

文档评论(0)