Example #1
0
int main()
{
    Solution sln;
    cout << sln.simplifyPath("/abc/../a") << endl; // /a
    cout << sln.simplifyPath("/a/./b/../../c/") << endl; // /c
    system("pause");
    return 0;
}
Example #2
0
int main()
{
    Solution s;

    std::cout << s.simplifyPath("/home/") << std::endl;
    std::cout << s.simplifyPath("/a/./b/../../c/") << std::endl;
    std::cout << s.simplifyPath("/../") << std::endl;
    std::cout << s.simplifyPath("/home//foo/") << std::endl;

    return 0;
}
Example #3
0
int main(){
    Solution s;
    cout<<(s.simplifyPath("/")=="/")<<endl;
    cout<<(s.simplifyPath("/a")=="/a")<<endl;
    cout<<(s.simplifyPath("/a/")=="/a")<<endl;
    cout<<(s.simplifyPath("/abc")=="/abc")<<endl;
    cout<<(s.simplifyPath("/a/./")=="/a")<<endl;
    cout<<(s.simplifyPath("/a/./b/")=="/a/b")<<endl;
    cout<<(s.simplifyPath("/a/./..")=="/")<<endl;
    cout<<(s.simplifyPath("/a/./../..")=="/")<<endl;
    cout<<(s.simplifyPath("/a/.//..////..")=="/")<<endl;
    cout<<(s.simplifyPath("/../")=="/")<<endl;
    cout<<(s.simplifyPath("/.")=="/")<<endl;
}
Example #4
0
int main() {
	Solution s;
	string path;
	while (cin >> path)
		cout << s.simplifyPath(path) << endl;
	return 0;
}
Example #5
0
int main()
{
    Solution s;
    cout << s.simplifyPath("/a/./b/..////../c/") << endl;;
    
    return 0;
}
int main(int argc, char *argv[]) {
    Solution sol;
    {
         cout << sol.simplifyPath("/a/../../b/../../c/") <<endl;
    }
    return 0;
}
Example #7
0
int main() {

    Solution v;

    cout << v.simplifyPath("/home//foo/") << endl;
    return 0;
}
Example #8
0
int main () {
    string input;
    cin >> input;
    Solution test;
    cout << test.simplifyPath(input) << endl;
    return 0;
}
Example #9
0
int main (int argc, char const *argv[])
{
	Solution s;
	string p("/home//foo");
	cout << s.simplifyPath(p);
	return 0;
}
int main(){
	Solution sol;
	string path1 = "/a/./b/../../c/";
	string path2 = "/home/";
	string path3 = "/../";
	string path4 = "/home//foo/";
	string path5 = "/...";
	string path6 = "/..hidden";
	cout<<sol.simplifyPath(path1)<<endl;
	cout<<sol.simplifyPath(path2)<<endl;
	cout<<sol.simplifyPath(path3)<<endl;
	cout<<sol.simplifyPath(path4)<<endl;
	cout<<sol.simplifyPath(path5)<<endl;
	cout<<sol.simplifyPath(path6)<<endl;
	cout<<"\n========answer========"<<endl;
	cout<<"/c\n/home\n/\n/home/foo\n/...\n/..hidden"<<endl;
}
Example #11
0
int main()
{
    Solution s;
    string test("/.././GVzvE/./xBjU///../..///././//////T/../../.././zu/q/e");
    cout<< s.simplifyPath(test)<<endl;
    system("pause");
    return 0;
}
TEST(Baisc, basic02){
    string input("/.../");
    Solution sol;
    string output = sol.simplifyPath(input);
    string expected("/...");
    ASSERT_EQ(input, expected);

}
Example #13
0
int main() {
    ofstream fout("sol.out");
    ifstream fin("sol.in");

    Solution sol;
    cout << sol.simplifyPath("/.hidden") << endl;
    return 0;
}
Example #14
0
int main() {
    Solution sol;
    string s;
    cin >> s;
    cout << sol.simplifyPath(s) << endl;

    return 0;
}
Example #15
0
int main(){
  Solution s;
  string s1 ="/home/jimber/./a/../Xin/";
  string s2 = "/home//foo/";
  string res1 = s.simplifyPath(s1);
  string res2 = s.simplifyPath(s2);
  return 0;
}
Example #16
0
int main()
{
    Solution s;
    string path;
    getline(cin, path);
    cout << s.simplifyPath(path) << endl;

    return 0;
}
Example #17
0
int main() {
  Solution s;
  string str;
  
  str = "/../";
  cout << str << " --- " << s.simplifyPath(str) << endl;

  return 0;
}
Example #18
0
int main(int argc, const char * argv[]) {
    // insert code here...
    Solution so;
    //point may be contained in names.
    string str = "/..hidden.../";
    string result = so.simplifyPath(str);
    cout<<result<<endl;
    return 0;
}
Example #19
0
int main()
{
    Solution s;
     // cout << s.simplifyPath("") << endl;
     // cout << s.simplifyPath("/") << endl;
     // cout << s.simplifyPath("//") << endl;
     // 
     // cout << s.simplifyPath("/.") << endl;
     cout << s.simplifyPath("/..") << endl;
     
     
     cout << s.simplifyPath("/home/") << endl;
     cout << s.simplifyPath("/home//") << endl;
    cout << s.simplifyPath("/a/./b/../../c/") << endl;

    system("pause");
    return 0;
}
Example #20
0
int main() {
	string path = "/..";
	Solution s;
	string res = s.simplifyPath(path);
	cout << res << endl;

	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	return 0;
}
Example #21
0
int main()
{
	Solution s;
	{
		cout << s.simplifyPath("/.") << endl;
	}

	std::cin.get();
	return 0;
}
Example #22
0
int main()
{
    Solution s;

    string path = "/a/./b/../../c/";

    cout << s.simplifyPath(path) << endl;

    system("pause");
    return 0;
}
Example #23
0
int main(int arg, char *argv[]) {
    // insert code here...
    cout << "LeetCode 071 Simplify Path, C++ ...\n\n";
    Solution sol;
    
    string path = "/";
    string r = sol.simplifyPath(path);
    cout << "^" << r << "$\n";
    
    return 0;
}
Example #24
0
int main(void) {

    Solution solution;
    cout << solution.simplifyPath("/a/./b/../..///c/") << endl;
    cout << solution.simplifyPath("/home/") << endl;
    cout << solution.simplifyPath("/a/..") << endl;
    cout << solution.simplifyPath("/../") << endl;
    cout << solution.simplifyPath("/.hidden") << endl;
    cout << solution.simplifyPath("/.") << endl;
}
Example #25
0
int main(void)
{
	const int N=8;
    string testCase[N][2]={
		{"/","/"},
		{"/home/","/home"},
		{"/a/./b/../../c/","/c"},
		{"/home//foo/","/home/foo"},
		{"/../","/"},
		{"/.hidden/","/.hidden"},
		{"/...","/..."},
		{"/home/../../..","/"}
	};
	Solution sol;
	for (int i = 0; i < N; i++) {
		cout<<"Case "<<i+1<<" "<<sol.simplifyPath(testCase[i][0])<<"=="<<testCase[i][1]<<endl;
	}
    return 0;
}
int main(){
    Solution sol;
    cout<<sol.simplifyPath("/a/");
}
void main(){
    string s = "/a/./b/../../c/";
    Solution sol;
    string ss = sol.simplifyPath(s);
}
Example #28
0
void honglei(string path) {
    static Solution solve;
    string simplify = solve.simplifyPath(path);
    printf("%s => %s\n", path.c_str(), simplify.c_str());
}
Example #29
0
int main() {
	Solution s;
	string path = "/abc/...";
	cout << s.simplifyPath(path) << endl;
	return 0;
}
Example #30
0
 static void runTest(string path) {
     Solution solution;
     string result = solution.simplifyPath(path);
     cout << result << endl;
 }