Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3.  
  4. using namespace std;
  5.  
  6. string concatenated(string arr[], int n)
  7. {
  8.     string result ="";
  9.     for (int i = 0; i < n; i++)
  10.     {
  11.         bool isLowerLatin = true;
  12.         string str = arr[i];
  13.  
  14.         for (int i = 0; i < str.length(); i++)
  15.         {
  16.             if(str[i] < 97 || str[i] > 122  ) isLowerLatin = false;
  17.         }
  18.  
  19.         if(isLowerLatin)
  20.         {
  21.             result.insert(0, str);
  22.         }
  23.     }
  24.  
  25.     return result;
  26. }
  27.  
  28. int main()
  29. {
  30.     /*
  31.     test input: 3 abc Abc uvw
  32.     */
  33.  
  34.     int n;
  35.     cin >> n;
  36.  
  37.     string arr[20];
  38.     for (int i = 0; i < n; i++)
  39.     {
  40.         cin >> arr[i];
  41.     }
  42.  
  43.     cout << concatenated(arr, n);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement