Wednesday, May 10, 2017

URI Solution 1215 Andy's First Dictionary | Data Structures

URI Solution 1215 Andy's First Dictionary | Data Structures


URI Online Judge Solution  1215 Andy's First Dictionary | Data structures

Problem Name: URI Problem 1215 Andy's First Dictionary 
Problem Number : URI Problem 1215 Andy's First Dictionary  Solution
Online Judge : URI Online Judge Solution
Level: Data structures
Solution Language : C, C plus plus

URI Solution 1215 Andy's First Dictionary | Data Structures

URI Solution 1215 Andy's First Dictionary Code in CPP:


#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <string.h>
#include <set>

using namespace std;

vector<string> v;
set<string> ss;

int main(int argc, char const *argv[])
{
 int l, i;
 char s[10005];
 char * pch;

 while(scanf("%s", s) == 1)
 {
  getchar();
  l = strlen(s);

  if(!l)
   continue;

  for (i = 0; i < l; ++i)
  {
   s[i] = tolower(s[i]);
   if(s[i] < 'a' || s[i] > 'z')
    s[i] = 32; 
  }

  pch = strtok(s, " ");

  while(pch != NULL)
  {
   if(strlen(pch) != 0)
    ss.insert(pch);
   pch = strtok(NULL, " ");
  }
 }

 set<string>::iterator it;
 for(it = ss.begin(); it != ss.end(); it++){
  printf("%s\n", (*it).c_str() );
 }

 return 0;
}

Tag: Uri solve 1215 Andy's First Dictionary , Uri solution 1215 Andy's First Dictionary , URI oj Solve 1215 Andy's First Dictionary 

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.