10-4. Left shift of string loop (20)

Source: Internet
Author: User

Enter a string and a non-negative integer N, and the string must be shifted left n times.

Input Format:

The input row contains a non-empty string of no more than 1st characters ending with a carriage return. The input row contains a non-negative integer n.

Output Format:

Output the string after N cycles are shifted left in one row.

Input example:

Hello world! 2

Output example:

LLO world! He



1 # include <stdio. h> 2 # include <string. h> 3 4 int main () 5 {6 char STR [101]; 7 int t; 8 gets (STR); 9 scanf ("% d", & T ); 10 int I, str_len; 11 str_len = strlen (STR); 12 if (T> str_len) {13 T % = str_len; 14} 15 for (I = T; I <str_len; I ++) {16 printf ("% C", STR [I]); 17} 18 for (I = 0; I <t; I ++) {19 printf ("% C", STR [I]); 20} 21 22 return 0; 23}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.