UVA 12243 - Flowers Flourish from France

UVA Sep 1, 2020

Problem PDF

Solution:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
    char s[2000];
    char c;
    while(gets(s))
    {
        if(!strcmp(s,"*"))
        break;
        int p=0,k=0;
        for(int i=0;s[i]!='\0';i++)
        {
            if(s[i]>='A'&&s[i]<='Z')
            s[i]=s[i]+32;
            if(s[i]==' ')
            p++;
        }
        c=s[0];
        int f=0;
         for(int i=0;s[i]!='\0';i++)
         {
             if(s[i]==' ')
             {
                 if(c==s[i+1])
                 k++;
             }

         }
         if(p==k){
         printf("Y\n");
         continue;
         }
         else{
         printf("N\n");
         continue;
         }
    }
    return 0;
}
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/12243/12243.cpp

Tags

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.