Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <limits.h>
- #include <iostream>
- #include <string.h>
- using namespace std;
- static void
- optimize(char *s, int n)
- {
- for (int i = 0; i < s; i++) {
- if (s[i] == '.') {
- if (s[i + 1] == '.') {
- if (s[i + 2] == '/') {
- s[i] = '\0';
- s[i + 1] = '\0';
- s[i + 2] = '\0';
- for (int j = i - 1; j >= 1; j++) {
- if (s[j - 1] == '/') {
- s[j - 1] = '\0';
- break;
- }
- s[j - 1] = '\0';
- }
- }
- } else if (s[i + 1] == '/') {
- s[i] = '\0';
- s[i + 1] = '\0';
- }
- }
- }
- }
- char *
- relativize_path(const char *path1, const char *path2)
- {
- char result[MAX_PATH + 7], char temp[MAX_PATH + 7];
- strcpy(temp, path1);
- strcpy(result, path2);
- int n1 = strlen(result);
- for (int i = 0; i < n1; i++) {
- if (temp[)
- }
- }
- int
- main()
- {
- char s1[MAX_PATH + 7], s2[MAX_PATH + 7];
- cin >> s1 >> s2;
- cout << relativize_path(s1, s2) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement