多重冒号(::)在编程中的核心作用:从命名空间到代码组织
2026/6/24 23:21:07
class Solution { public: // Encodes a URL to a shortened URL. string encode(string longUrl) { for(int i=0;i<longUrl.size();i++){ longUrl[i]^=12; } return longUrl; } // Decodes a shortened URL to its original URL. string decode(string shortUrl) { for(int i=0;i<shortUrl.size();i++){ shortUrl[i]^=12; } } }; // Your Solution object will be instantiated and called as such: // Solution solution; // solution.decode(solution.encode(url));异或‘^’可以对地址进行加密操作。