一、Java
- class Solution {
- public String dynamicPassword(String password, int target) {
- return password.substring(target) + password.substring(0, target);
- }
- }
二、C++
- #include
- using namespace std;
- class Solution {
- public:
- string dynamicPassword(string password, int target) {
- return password.substr(target) + password.substr(0, target);
- }
- };
三、Python
- class Solution:
- def dynamicPassword(self, password: str, target: int) -> str:
- return password[target:] + password[0:target]
四、JavaScript
- var dynamicPassword = function(password, target) {
- return password.substring(target) + password.substring(0, target);
- };
五、Go
- package main
-
- func dynamicPassword(password string, target int) string {
- return password[target:] + password[0:target];
- }