Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- void solve(char *s) {
- char aux[102] = {};
- char arr[102][102] = {};
- int arrLen = 0;
- {
- char *p = strtok(s, " ");
- while (p) {
- strcpy(arr[arrLen++], p);
- p = strtok(NULL, " ");
- }
- }
- strcat(aux, arr[0]);
- strcat(aux, " ");
- for (int i = 1; i < arrLen; i++) {
- int n1 = strlen(arr[i - 1]), n2 = strlen(arr[i]);
- if (arr[i - 1][n1 - 1] == arr[i][n2 - 1]) {
- strcat(aux, "succes");
- strcat(aux, " ");
- }
- strcat(aux, arr[i]);
- strcat(aux, " ");
- }//*/
- strcpy(s, aux);
- }
- int main() {
- char s[102];
- gets(s);
- solve(s);
- puts(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement