Problem 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

大水题!!!

就是一个字符串删除第n(从1开始)个字符就可以了。

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int p=1;
int t =sc.nextInt();
while(t-->0){
int a = sc.nextInt();
String str=sc.next();
System.out.print((p++)+" ");
for(int i=0;i<str.length();i++){
if(i!=(a-1)){
System.out.print(str.charAt(i));
}
}
System.out.println();
}
}
}

HDOJ/HDU 1984 Mispelling4(删除第n个字符~)的更多相关文章

  1. HDOJ(HDU).1412 {A} + {B} (STL SET)

    HDOJ(HDU).1412 {A} + {B} (STL SET) 点我挑战题目 题意分析 大水题,会了set直接用set即可. 利用的是set的互异性(同一元素有且仅有一项). #include ...

  2. HDOJ(HDU).1754 I Hate It (ST 单点替换 区间最大值)

    HDOJ(HDU).1754 I Hate It (ST 单点替换 区间最大值) 点我挑战题目 题意分析 从题目中可以看出是大数据的输入,和大量询问.基本操作有: 1.Q(i,j)代表求区间max(a ...

  3. HDOJ(HDU).1166 敌兵布阵 (ST 单点更新 区间求和)

    HDOJ(HDU).1166 敌兵布阵 (ST 单点更新 区间求和) 点我挑战题目 题意分析 根据数据范围和询问次数的规模,应该不难看出是个数据结构题目,题目比较裸.题中包括以下命令: 1.Add(i ...

  4. HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化)

    HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化) 题意分析 先把每种硬币按照二进制拆分好,然后做01背包即可.需要注意的是本题只需要求解可以凑出几种金钱的价格,而不需要输出种数 ...

  5. HDOJ(HDU).1059 Dividing(DP 多重背包+二进制优化)

    HDOJ(HDU).1059 Dividing(DP 多重背包+二进制优化) 题意分析 给出一系列的石头的数量,然后问石头能否被平分成为价值相等的2份.首先可以确定的是如果石头的价值总和为奇数的话,那 ...

  6. HDOJ(HDU).2191. 悼念512汶川大地震遇难同胞――珍惜现在,感恩生活 (DP 多重背包+二进制优化)

    HDOJ(HDU).2191. 悼念512汶川大地震遇难同胞――珍惜现在,感恩生活 (DP 多重背包+二进制优化) 题意分析 首先C表示测试数据的组数,然后给出经费的金额和大米的种类.接着是每袋大米的 ...

  7. HDOJ(HDU).2159 FATE (DP 带个数限制的完全背包)

    HDOJ(HDU).2159 FATE (DP 带个数限制的完全背包) 题意分析 与普通的完全背包大同小异,区别就在于多了一个个数限制,那么在普通的完全背包的基础上,增加一维,表示个数.同时for循环 ...

  8. HDOJ(HDU).4508 湫湫系列故事――减肥记I (DP 完全背包)

    HDOJ(HDU).4508 湫湫系列故事――减肥记I (DP 完全背包) 题意分析 裸完全背包 代码总览 #include <iostream> #include <cstdio& ...

  9. HDOJ(HDU).1284 钱币兑换问题 (DP 完全背包)

    HDOJ(HDU).1284 钱币兑换问题 (DP 完全背包) 题意分析 裸的完全背包问题 代码总览 #include <iostream> #include <cstdio> ...

随机推荐

  1. 淘宝可以传照片搜索商品,verygood.雅客VC多味水果糖

    奶奶喜欢吃点硬糖.在当地买了些说是不好.到是一个亲戚买的一种糖比较满意(好久了都快融化了). 但是我只有照片,能知道品牌,在jd没这样一样的商品了. 还好借助淘宝的传照片功能,找到了.

  2. Spark-Cassandra-Connector 插入数据函数saveToCassandra

    在spark-shell中将数据保存到cassandra: var data = normalfill.map(line => line.split("\u0005")) d ...

  3. ubuntu zend-eclipse-php debugger调试

    1 下载zendDebugger http://www.zend.com/en/products/studio/downloads?src=downloadb 在这个页面中找到zend debugge ...

  4. 安装交叉编译arm-linux-gcc环境

    设置好交叉编译的执行文件路径贴加到环境变量PATH 设置如下 export PATH=$PATH:/XXX/XXX/bin /etc/profile /~/.bashrc source  /etc/p ...

  5. centos 忘记 root 密码

    采用单用户维护模式可以重设置新密码 系统重启,按任意键进入如下所示的菜单: 选择“kernel /.....”根据提示,按下 "e" 就能进入grup 编辑模式,此时出现的画面类似 ...

  6. jQuery 之 .stop() 方法

    总结version 1.7版本前.stop([clearQueue][,jumpToEnd])clearQueue: 布尔值,默认是 false;此值处理是相关的动画队列是否移除,如果为 false ...

  7. 精通 Oracle+Python,第 1 部分:查询最佳应践

    原文链接:http://www.oracle.com/technetwork/cn/articles/dsl/mastering-oracle-python-1391323-zhs.html 在 Py ...

  8. arm-linux-gcc编译器定义寄存器变量

    uboot代码中有这么一句话“#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")”, ...

  9. 转载:Source Insight查看ARM汇编源程序 && 高亮显示程序 && Source Insight打开project窗口出错

    (1)Source Insight查看ARM汇编源程序.做ARM嵌入式开发时,有时得整汇编代码,但在SIS里建立PROJECT并ADD TREE的时候,根据默认设置并不会把该TREE里面所有汇编文件都 ...

  10. UM分享 - 详解

    官网: http://dev.umeng.com 友盟现在发展的很壮大! 有熟为人知的社会化分享\统计分析\消息推送\即时通信\自动更新\多媒体服务等功能, 今天就其中第一项 分享功能, 做出分解. ...