String 3210. Find the Encrypted String ¶ Time: $O(n)$ Space: $O(n)$ C++JavaPython 1 2 3 4 5 6 7class Solution { public: string getEncryptedString(string s, int k) { k %= s.length(); return s.substr(k) + s.substr(0, k); } }; 1 2 3 4 5 6class Solution { public String getEncryptedString(String s, int k) { k %= s.length(); return s.substring(k) + s.substring(0, k); } } 1 2 3 4class Solution: def getEncryptedString(self, s: str, k: int) -> str: k %= len(s) return s[k:] + s[0:k]