A. Petya and Strings
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two stringslexicographically.
The letters' case does not matter, that is an uppercase letter is considered equivalent to the corresponding lowercase letter. Help Petya perform the comparison.

Input

Each of the first two lines contains a bought string. The strings' lengths range from 1 to 100 inclusive.
It is guaranteed that the strings are of the same length and also consist of uppercase and lowercase Latin letters.

Output

If the first string is less than the second one, print "-1". If the second string is less than the first one, print "1". If the strings are equal, print "0". Note that the letters' case is not taken into consideration when the strings are compared.

Sample test(s)
input
aaaa
aaaA
output
0
input
abs
Abz
output
-1
input
abcdefg
AbCdEfF
output
1
比較两个字符串的大小,不区分大写和小写。。
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
const int INF = 0x3f3f3f3f;
#define LL long long
char s1[200], s2[200];
int main()
{
while (scanf("%s%s", s1, s2) != EOF) {
for (int i = 0; i < strlen(s1); i++) {
s1[i] = toupper(s1[i]);
} for (int i = 0; i < strlen(s2); i++) {
s2[i] = toupper(s2[i]);
} printf("%d\n", strcmp(s1, s2));
} return 0;
}

Codeforces 112A-Petya and Strings(实现)的更多相关文章

  1. Codeforces 385B Bear and Strings

    题目链接:Codeforces 385B Bear and Strings 记录下每一个bear的起始位置和终止位置,然后扫一遍记录下来的结构体数组,过程中用一个变量记录上一个扫过的位置,用来去重. ...

  2. Codeforces 482C Game with Strings(dp+概率)

    题目链接:Codeforces 482C Game with Strings 题目大意:给定N个字符串,如今从中选定一个字符串为答案串,你不知道答案串是哪个.可是能够通过询问来确定, 每次询问一个位置 ...

  3. codeforces水题100道 第二十四题 Codeforces Beta Round #85 (Div. 2 Only) A. Petya and Strings (strings)

    题目链接:http://www.codeforces.com/problemset/problem/112/A题意:忽略大小写,比较两个字符串字典序大小.C++代码: #include <cst ...

  4. Codeforces 149 E. Martian Strings

    正反两遍扩展KMP,维护公共长度为L时.出如今最左边和最右边的位置. . .. 然后枚举推断... E. Martian Strings time limit per test 2 seconds m ...

  5. CodeForces 832B Petya and Exam

    B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  6. A - Petya and Strings

    Problem description Little Petya loves presents. His mum bought him two strings of the same size for ...

  7. CodeForces 362E Petya and Pipes

    Petya and Pipes Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...

  8. 【24.34%】【codeforces 560D】Equivalent Strings

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. codeforces B. Petya and Staircases 解题报告

    题目链接:http://codeforces.com/problemset/problem/362/B 题目意思:给出整数n和m,表示有n级楼梯和m级dirty的楼梯,接下来m个数表示对应是哪一个数字 ...

  10. CodeForces 682D Alyona and Strings (四维DP)

    Alyona and Strings 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/D Description After re ...

随机推荐

  1. AC日记——Power收集 洛谷 P3800

    Power收集 思路: 单调队列优化dp: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 4005 stru ...

  2. jquery请求解析xml

    我们使用jque.ajax来做这个实验.其核心实现原理就是将请求回来的xml数据用$()选择器封装,然后进行傻瓜式操作. 代码如下: 需要注意的是请求数据格式要声明成:xml.不然不生效. $.aja ...

  3. 7.spark Streaming 技术内幕 : 从DSteam到RDD全过程解析

    原创文章,转载请注明:转载自 听风居士博客(http://www.cnblogs.com/zhouyf/)   上篇博客讨论了Spark Streaming 程序动态生成Job的过程,并留下一个疑问: ...

  4. POJ 2777 Count Color(线段树 + 染色问题)

    传送门:Count Color Description Chosen Problem Solving and Program design as an optional course, you are ...

  5. js相关数组迭代方法图解

  6. 一个Bean属性拷贝的工具类

    package com.fpi.spring.qaepb.cps.util; import java.beans.IntrospectionException; import java.beans.P ...

  7. NOIP2017酱油记

    分数线终于出了,于是大胆地写下了这篇博文. 提高组Day1: T1: 打开PDF就感觉到一股骚气,不忘初心什么鬼啊??T1是数论??好一个不忘初心... 看一下样例1:3 7:11 莫不是3*7-10 ...

  8. c++风格

    http://web.archive.org/web/20160430022340/http://google.github.io/styleguide/cppguide.html 主要注意几点: 函 ...

  9. 【kubernetes】ubuntu14.04 64位 搭建kubernetes过程

    背景: Kubernetes介绍:http://kubernetes.io/docs/getting-started-guides/ github地址:https://github.com/kuber ...

  10. LAMP搭建Discuz论坛

    搭建Discuz论坛 1.  准备LAMP环境 LAMP是Linux,Apache,MySql和PHP的缩写,是Discuz论坛系统依赖的基础运行环境 1.安装Apache2 Ubuntu需要安装Ap ...