文章

27

粉丝

492

获赞

10

访问

255.3k

头像
入门-字符串类问题
备考心情
发布于2021年2月27日 20:27
阅读数 7.5k

1240 首字母大写

输入:
 if so, you already have a google account. you can sign in on the right.

输出:

If So, You Already Have A Google Account. You Can Sign In On The Right.
 String []strs=sc.nextLine().split(" ");
	    for(int i=0;i<strs.length;i++) {
	    	strs[i]=strs[i].substring(0,1).toUpperCase()+strs[i].substring(1);
	    }

1394 统计单词

输入:


hello how are you.

输出:


5 3 3 3

int count=0;
			for (int i = 0; i < c.length; i++) {
				 if(c[i]!=' '&&c[i]!='.') {
					 count++;
				 }else {
					 if(count!=0) {
						 System.out.print(count+" ");
						 count=0;
					 }
				 }
			}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发