Code Forces 59A Word
来源:互联网 发布:sql中amount可以更新吗 编辑:程序博客网 时间:2024/06/13 06:35
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of uppercase ones. At that as little as possible letters should be changed in the word. For example, the wordHoUse must be replaced with house, and the word ViP — with VIP. If a word contains an equal number of uppercase and lowercase letters, you should replace all the letters with lowercase ones. For example,maTRIx should be replaced by matrix. Your task is to use the given method on one given word.
The first line contains a word s — it consists of uppercase and lowercase Latin letters and possesses the length from1 to 100.
Print the corrected word s. If the given words has strictly more uppercase letters, make the word written in the uppercase register, otherwise - in the lowercase one.
HoUse
house
ViP
VIP
maTRIx
matrix
水到不能再水的题,娱乐放松用。
using System;namespace AcmCsharp{ class Program { static void Main(string[] args) { string s = Console.ReadLine(); int k = 0; foreach (char item in s) if (Char.IsUpper(item)) k++; if (s.Length- k >= k) Console.Write(s.ToLower()); else Console.Write(s.ToUpper()); } }}
- Code Forces 59A Word
- code forces 1A
- code forces 377A
- code forces 505A
- Code Forces 587A
- Code Forces 588A
- [code forces] 762A
- code forces 393A Nineteen
- code forces 399A Pages
- code forces 402A Nuts
- code forces 2A Winner
- code forces 407A Triangle
- Code Forces 298 A EXAM
- Code Forces 37A Towers
- code forces E A rectangle
- Code Forces 21 A(模拟)
- 【code forces】652A模拟
- Code Forces 380 A. Sereja and Prefixes
- java基础
- HDU 1429 BFS + 状压
- android中的线程执行UI更新方式,以及Handler的初步了解
- C++生成随机数:高斯/正态分布(gaussian/normal distribution)
- this指针
- Code Forces 59A Word
- 回调函数的原理及PHP实例
- redis sort命令用法
- 浮点数的输入以及浮点数运算
- UVa 401 - Palindromes
- 2015/8/16
- 107Binary Tree Level Order Traversal II
- android应用在线完整更新
- JavaScript数据类型判断--使用toString方法