Sunday, April 30, 2017

URI Solution 1140 Flowers Flourish from France - Solution in C++ | Ad Hoc

URI Solution 1140 Flowers Flourish from France - Solution in C++ | Ad Hoc


URI Online Judge Solution  Flowers Flourish from France | Ad Hoc
URI 1140 Main Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1140

Problem Name: URI Problem Flowers Flourish from France
Problem Number : URI - 1140
Online Judge : URI Online Judge Solution
Level: Ad Hoc
Solution Language : C plus plus

URI Solution 1140 Code in CPP:


#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main()
{
 int size;
 string s;
 char c;
 bool b, check;

 while(getline(cin, s))
 {
  if(s == "*")
   break;

  transform (s.begin(), s.end(), s.begin(), ::tolower);
  size = s.size();
  c = s[0];
  b = false; check = true;

  for (int i = 0; i < size; ++i)
  {
   if(s[i] != ' ' && b == false){
    if(s[i] != c){
     check = false;
    }
    
    b = true;
   }else{
    if(s[i] == ' ')
     b = false;
   }   
  }

  if(check){
   puts("Y");
  }else{
   puts("N");
  }
 }

 return 0;
}

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.