Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 402678f

Browse files
Create String_Tokenizer.java
1 parent f202f38 commit 402678f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎String/String_Tokenizer.java‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// reverse_each_word
2+
import java.util.*;
3+
public class reverse_each_word
4+
{
5+
public static void main()
6+
{
7+
Scanner ob=new Scanner(System.in);
8+
int i,j;
9+
System.out.println("enter string");
10+
StringTokenizer s=new StringTokenizer(ob.nextLine(),"!");
11+
int n=s.countTokens();//count words
12+
String a[]=new String[n];
13+
for(i=0;i<n;i++)
14+
{
15+
a[i]=s.nextToken();
16+
}
17+
for(i=n-1;i>=0;i--)
18+
{
19+
System.out.print(a[i]+" ");
20+
}
21+
}
22+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /