Mispelling4

Description

Misspelling is an art form that students seem to excel at. Write a program that removes the nth character from an input string.

 

Input

The first line of input contains a single integer N, (1 ≤ N ≤ 1000) which is the number of datasets that follow.
Each dataset consists of a single line of input containing M, a space, and a single word made up of uppercase letters only. M will be less than or equal to the length of the word. The length of the word is guaranteed to be less than or equal to 80.

 

Output

For each dataset, you should generate one line of output with the following values: The dataset number as a decimal integer (start counting at one), a space, and the misspelled word. The misspelled word is the input word with the indicated character deleted.

 

Sample Input


 

4

4 MISSPELL

1 PROGRAMMING

7 CONTEST

3 BALLOON

 

Sample Output


 

1 MISPELL

2 ROGRAMMING

3 CONTES

4 BALOON

大概意思是刪掉一個單詞裏面的第M個字符,水題

#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
lint qsm(lint a,lint b){
    a%=100;
    lint ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%100;
        b>>=1;
        a=(a*a)%100;
    }
    return ans;
}
lint aa(int n){
    lint i,a,b,t;
    a=b=1;
    if(n<3){
        return 1;
    }
    for(i=3;i<=n;++i){
        t=b;
        b=a+b;
        a=t;
    }
    return b;
}
int main()
{
    int t;
    while(cin>>t){
        int ans=1;
        while(t--){
            int n;
            char s[88];
            scanf("%d %s",&n,s);
            cout<<ans++<<" ";
            for(int i=0;i<strlen(s);++i){
                if(i!=n-1)
                    cout<<s[i];
            }
            cout<<endl;
        }
    }
    return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章