SHARE
TWEET

Untitled

a guest Dec 19th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     char text[100];
  10.     char cuvinte[100][100];
  11.     int k = 0;
  12.     bool flag = 0;
  13.     cin.get(text, 99);
  14.     cin.get();
  15.     char* p;
  16.     p = strtok(text, " ");
  17.     while (p != NULL)
  18.     {
  19.         strcpy(cuvinte[k], p);
  20.         k++;
  21.         p = strtok(NULL, " ");
  22.     }
  23.     for (int i = 0; i < k; i++)
  24.     {
  25.         if (strlen(cuvinte[i]) % 2 == 1)
  26.         {
  27.             char cuvantTest[100];
  28.             strcpy(cuvantTest, cuvinte[i]);
  29.             int mijloc = strlen(cuvantTest) / 2;
  30.             strcpy(cuvantTest + mijloc + 1, cuvantTest + mijloc);
  31.             cout << cuvantTest << endl; ///aici arata creeee
  32.             for (int j = 0; j < k; j++)
  33.             {
  34.                 if (strcmp(cuvinte[j], cuvantTest) == 0)
  35.                 {
  36.                     flag = 1;
  37.                     break;
  38.                 }
  39.             }
  40.         }
  41.     }
  42.     if (flag == 0)
  43.     {
  44.         cout << "NU";
  45.     }
  46.     else
  47.     {
  48.         cout << "DA";
  49.     }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top