struct ListNode* rotateLinkedList(struct ListNode* head, int k ) 
{
    // write code here
    int count=0;
    struct ListNode*c=head;
    while(c)   // 统计链表长度
    {
        count++;
        c=c->next;
    }
    if(count==0) // 特判长度为零
    {
        return head;
    }
    k%=count;
    if(k==0)    // 特判无需翻转
    {
        return head;
    }
    int i=0;
    struct ListNode*cur=head;
    for(i=0;i<count-k-1;i++)  // 找到反转后的链表头
    {
        cur=cur->next;
    }
    struct ListNode*newhead=cur->next; // 标记新链表头
    cur->next=NULL;
    cur=newhead;
    while(cur->next!=NULL)   // 原链表尾与头链接
    {
        cur=cur->next;
    }
    cur->next=head;
    return newhead;
}