UVA 12543 - Longest Word

UVA Sep 01, 2020

Problem PDF

Solution:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
using namespace std;
#define ll long long
#define sc scanf
#define pf printf
#define Pi 2*acos(0.0)
int main()
{
    char s[1000005],a[1000005];
        int max=1;
    while(sc("%s",s))
    {
        if(!strcmp(s,"E-N-D"))
        break;
        int l=strlen(s);
        int c=0;
        for(int i=0;i='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'||s[i]=='-')
            continue;
            else
            c++;
        }
        l=l-c;
        if(max='A'&&a[i]<='Z')
    pf("%c",a[i]+32);
    else if(a[i]>='a'&&a[i]<='z'||a[i]=='-')
    pf("%c",a[i]);
    }
    pf("\n");
    return 0;
}
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/12543/12543.cpp

Tags

Shipu Ahamed

CSPO® | Partly Product, Project Manager and Partly Software Engineer.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.