Codeforces 59AWord Solution in C/CPP

Codeforces 59AWord Solution

question

Codeforces 59AWord Solution in CPP

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    string a;
    int l=0,u=0;
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]>='a'&& a[i]<='z') {

            l++;
        }
        else
            u++;
    }
    if(l>=u){
        for(int i=0;i<a.size();i++)//Codeforces 59A.Word  Solution
            a[i]=tolower(a[i]);

        cout<<a<<endl;
    }
    else
    {
        for(int i=0;i<a.size();i++)
        {
            a[i]=toupper(a[i]);
        }
        cout<<a<<endl;
    }

}

Codeforces 59AWord Solution in C

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define MAX_SIZE 1000

int main()
{
    char a[MAX_SIZE];
    int l = 0, u = 0;
    scanf("%s", a);

    for (int i = 0; i < strlen(a); i++)
    {
        if (islower(a[i]))
        {
            l++;
        }
        else
        {
            u++;
        }
    }

    if (l >= u)
    {
        for (int i = 0; i < strlen(a); i++)
        {
            a[i] = tolower(a[i]);
        }
        printf("%s\n", a);
    }
    else
    {
        for (int i = 0; i < strlen(a); i++)
        {
            a[i] = toupper(a[i]);
        }
        printf("%s\n", a);
    }

    return 0;
}


Codeforces734A Anton and Danik solution

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
NEW TOXIC ROCKET CYCLE DECK in Clash Royale 2023 Best Deck in Clash Royale Best Deck for Arena 8 in Clash Royale Best Hog deck for Pro players Best Clash Royale Deck