Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. char s[256], * p;
  7. char new_s[16][256];
  8.  
  9. int main()
  10. {
  11. int i, j, n;
  12. char last;
  13.  
  14. cin >> n;
  15.  
  16. n++;
  17. for(i = 0, j = 0; i < n; i++)
  18. {
  19. cin.getline(s, 256);
  20.  
  21. last = s[strlen(s) - 1];
  22. p = strtok(s, ".!?,");
  23. while(p)
  24. {
  25. strcat(new_s[j], p);
  26.  
  27. p = strtok(NULL, ".!?,");
  28. }
  29.  
  30. if(!isalpha(last))
  31. strncat(new_s[j], &last, 1);
  32. j++;
  33. }
  34.  
  35. for(i = 1; i < j; i++)
  36. cout << new_s[i] << '\n';
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement