标签:contain har arp next cab contains write foo span
String Rotation. Given two string check if String1 is rotating match for String2
# Given two strings. Write a function that will return true if one string is a rotation of the other string.
# e.g. ‘bca‘ and ‘cab‘ are rotations of ‘abc‘ and the function should return true
# ‘barbazfoo‘, ‘oobarbazf‘ and ‘rbazfooba‘ are rotations of ‘foobarbaz‘
def is_rotation(string1, string2):
import java.util.Scanner; public class StringCheck { public static void main(String[] args) { Scanner scan=new Scanner(System.in); String s1=scan.next(); String s2=scan.next(); String s=s2+s2; if (s1.length() == s2.length()){ return s.contains(s1); } else { return false; } } }
标签:contain har arp next cab contains write foo span
原文地址:http://www.cnblogs.com/apanda009/p/7998630.html